Jump to content
Search Community

mattsonl

Members
  • Posts

    6
  • Joined

  • Last visited

mattsonl's Achievements

0

Reputation

  1. Wow sorry, I was looking at it all the wrong way. I thought I had to access the square within the TransformItem, and trying to make it more complex than it really is. Thanks for you help.
  2. Ok, I am still a bit confused on how you actually access the custom element to set its visibility? So just as a very simple example, I have the following: myManager = new TransformManager(); var square:Sprite = new Sprite(); square.graphics.beginFill(0x0000FF); square.graphics.drawRect(0,0,80,30); square.graphics.endFill(); myManager.addSelectionBoxElement(square, "bottomRight", -80, 0); myManager.addEventListener(TransformEvent.SELECTION_CHANGE, onselectionchange, false, 0, true); var mcItem:TransformItem = myManager.addItem(myObject, TransformManager.SCALE_NORMAL, false); private function onselectionchange(e:TransformEvent):void { //??? } So, within the onselectionchange listener, how do I access the "square" from the selected object?
  3. I am attempting to use "addSelectionBoxElement" to add an edit button to a selected object in my application. After working with it a bit, I've realized that it is a TransformManager method, so it adds that edit button to every single TransformItem associated with my TransformManager. What I am trying to do is only add the edit button to specific TransformItems (for example I have Shapes, TextField, images, etc). Is there any way to only add the edit button for specific objects, or to hide the edit button when certain objects are selected? Thanks for your help.
  4. Oops, I forgot to add my response. Yes, I have done some customizations to the TransformManager and TransformItem, but nothing that should really mess with getting the parent of the target object. I am using version 1.96681. My "Hack" Solution I'm not exactly sure why, but when I add the following code to the onmousedown method in the TransformItem, it works: if(_target.parent == null) { _targetObject.parent.addChild(_proxy); } Any thoughts on why this is happening would be great. Otherwise, my "hack" seems to be working. It only happens when I use "SCALE_WIDTH_AND_HEIGHT" when adding a TransformItem. I guess once possible reason is the fact that I am using the TransformManager in a Flex project, but adding TransformItems as objects with pure AS3 (not Flex elements). So not sure if Flex does things differently when it comes to retrieving parents.
  5. I am having trouble using TransformManager with TextFields. I am dynamically adding a DisplayObject to the stage, which contains a Textfield. I then add the DisplayObject to the TransformManager, setting the scale to WIDTH_HEIGHT, like this: var mcItem:TransformItem = Application.application.designerControl.pageEditor.myManager.addItem(_view, TransformManager.SCALE_WIDTH_AND_HEIGHT, false); My DisplayObject is a custom class that automatically changes its width and height based on the TransformManager (creates a Sprite in TransformItem as a proxy). All works great when I add one DisplayObject to the stage, and transform its width and height. But once I add two DisplayObjects to the stage, switch between them and then try to transform the first one again, all of the sudden it gives me this error: TypeError: Error #1009: Cannot access a property of a null object reference. This error is occurring in the reposition() function within the TransformItem. Somehow, the _target.parent is getting lost when I select between the two separate TransformItems. protected function reposition():void { //Ensures that the _origin lines up with the _localOrigin. var p:Point = _target.parent.globalToLocal(_target.localToGlobal(_localOrigin)); _target.x += _origin.x - p.x; _target.y += _origin.y - p.y; } Can anyone please help me with this one? I cannot figure it out for the life of me. Thanks!
  6. Hi, I am having some problems transforming shapes w/ stroke using TransformManager for my application. Any help would be great! I have an app where I am letting users drag shapes out onto the stage, and be able to manipulate their size, x, y, color, stroke, etc. The problem I am running in to is when TransformManager scales a shape graphic: mySprite.graphics.lineStyle(1, 0x000000, 1); mySprite.graphics.beginFill(0xCCCCCC, 1); mySprite.graphics.drawRoundRect(0,0,50,50,0,0); mySprite.graphics.endFill(); mySprite.graphics.moveTo(0,0); mySprite.graphics.lineTo(0, 0); When resizing the shape, not only does the shape transform size but the stroke also transforms size. It is obviously scaling the entire shape, which includes the stroke/border (lineStyle). I need to be able to scale the shape, but keep the stoke from scaling. I did find one solution...setting the lineStyle scaleMode to "none". mySprite.graphics.lineStyle(1, 0x000000, 1, false, "none"); This works fine, but my app also allows the user to zoom up on the entire stage. I do this by changing the scaleX and scaleY of the parent container. When I zoom on the stage and the shape stoke has scaling set to "none", then my stoke does not scale. I DO NOT want the stoke to scale on resize using the TransformManger, but I DO want the stoke to scale when the user zooms the stage. I cannot for the life of me find a way to get around this without having to re-write a bunch of code. Please help!
×
×
  • Create New...