Jump to content
Search Community

jackfreak

Members
  • Posts

    5
  • Joined

  • Last visited

jackfreak's Achievements

0

Reputation

  1. It works! As far as I could see, it works when - The component to add is declared on the mxml - The component to add is created with "new SomeComponent()", and then explicitly assigning width/height. I would recommend to remove the "!t.hasOwnProperty("content") && " in the updateSelection() method leaving only "t.width != 0" as the condition: if (!t.hasOwnProperty("content") && t.width != 0) { //in Flex, SWFLoaders/Images and some other components don't accurately report width/height var m:Matrix = t.transform.matrix; t.transform.matrix = new Matrix(); //gets rid of all transformations. Bugs in the Flex framework prevented getBounds() from accurately reporting the width/height, so I had to remove all transformations and check it directly with object.width and object.height. r = t.getBounds(t); _dummyBox.graphics.drawRect(r.x, r.y, t.width, t.height); _dummyBox.transform.matrix = t.transform.matrix = m; } else { r = t.getBounds(t); _dummyBox.graphics.drawRect(r.x, r.y, r.width, r.height); _dummyBox.transform.matrix = t.transform.matrix; } because it has problems with spark TextArea and RichEditableText and I guess all others spark text components when they are created with AS instead of mxml. They have the same issue that Image and SwfLoader, getBounds() reports width 0 when they enter the "else" statement (r.width). I'll remove it for my project, and I leave it to you wether to make this modification or not, u know your code better than me , maybe this mod breaks something when using TransformManager in Flash, I don't know. Thanks man!
  2. Yeah, some of the bugs are really frustrating but with time and patience I learned to like Flex (for some projects). I've already tried to wait 1 frame to execute selectItem() and/or updateSelection() and didn't worked. Anyway, I just tried your suggestion in the FlexTransformManagerDemo and it works. The funny thing is that when I use the solution in my app, it doesn't!! I've found that In my app I have to wait 2 frames for the box and handlers to draw properly. The strangest thing is that works ok with 1.85, so it's not just the Flex getBounds() bug. I'll keep digging, thanks.
  3. Hey Jack, thanks for your quick answer. Sadly, it didn't quite worked. I grabbed a copy of the FlexTransformManagerDemo and Im testing there. When I add a text component directly with addItem, it doesn't work. private function init():void { myManager.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange, false, 0, true); myManager.addEventListener(TransformEvent.SCALE, onScale, false, 0, true); myManager.addEventListener(TransformEvent.FINISH_INTERACTIVE_SCALE, onFinishInteractiveScale, false, 0, true); myManager.addEventListener(TransformEvent.DOUBLE_CLICK, onDoubleClick, false, 0, true); var ret:RichEditableText = new RichEditableText(); ret.text = "Hello World!"; var ti:TransformItem = myManager.addItem( ret ); myManager.selectItem(ti); } When I add a text component directly with addItem, AND I explicitly set it's width and height, it DOES work. private function init():void { myManager.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange, false, 0, true); myManager.addEventListener(TransformEvent.SCALE, onScale, false, 0, true); myManager.addEventListener(TransformEvent.FINISH_INTERACTIVE_SCALE, onFinishInteractiveScale, false, 0, true); myManager.addEventListener(TransformEvent.DOUBLE_CLICK, onDoubleClick, false, 0, true); var ret:RichEditableText = new RichEditableText(); ret.width = 200; ret.height = 200; ret.text = "Hello World!"; var ti:TransformItem = myManager.addItem( ret ); myManager.selectItem(ti); } And finally, when I add a text component WRAPPED in a Canvas (which is exactly what I need to do in my project), doesn't work either. It didn't matter whether I set a width/height to the Canvas and/or the RichEditableText. private function init():void { myManager.addEventListener(TransformEvent.SELECTION_CHANGE, onSelectionChange, false, 0, true); myManager.addEventListener(TransformEvent.SCALE, onScale, false, 0, true); myManager.addEventListener(TransformEvent.FINISH_INTERACTIVE_SCALE, onFinishInteractiveScale, false, 0, true); myManager.addEventListener(TransformEvent.DOUBLE_CLICK, onDoubleClick, false, 0, true); var canvas:Canvas = new Canvas(); canvas.width = 200; canvas.height = 200; canvas.setStyle("backgroundColor", 0xff0000); var ret:RichEditableText = new RichEditableText(); ret.width = 200; ret.height = 200; ret.text = "Hello World!"; canvas.addChild(ret); var ti:TransformItem = myManager.addItem( canvas ); myManager.selectItem(ti); } It seems to be an initialization problem, because in all cases when I deselect and re-select the item with the mouse it draws everything perfectly. I'll keep trying to see if I can figure it out, but I would appreciate if you take a look at it. It's a great component specially for Flex appz. Thanks
  4. Hi Jack. I'm having a problem with FlexTransformManager when I add a TextArea or any other Flex text component to the transformManager. When I add the TextArea instance to my flexTransformManager and innmediately select it with selectItem(), it doesn't draw the bounding box nor the handles properly. I see only one handle in the top-left corner of the TextArea I added. My code is like this: var transformItem:TransformItem = flexTransformManager.addItem(textArea, TransformManager.SCALE_WIDTH_AND_HEIGHT); flexTransformManager.selectItem(transformItem); I even tried to wrap the TextArea in a Canvas, but the problem remains. The strange thing is that it works perfectly with any other type of objects, like Image component. Another thing to notice is that this didn't happen when I was using version 1.85. This bug started when I updated to 1.891. Now I am using 1.91. Can you take a look a it ? Cause I couldnt find any way to fix this. (btw, Im currently using Flex 4). Thanks
  5. Hi Jack, I was wondering if there's a particular reason that FlexTransformManager doesn't have a deleteSelection method? I'm currently working on Flash Builder 4, with the latest build 1.891 of TransformManager. I came to notice this because I need to delete all items from an instance of FlexTransformManager and I can't find the way to do this, can you point me in the right direction please?
×
×
  • Create New...