Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Dynamically add TransformManager

Recommended Posts



I encounter quite an embarrassing problem when I'm trying to dynamically add the transformer to the display list. Sometimes objects are first displayed but vanished when I click on them, sometimes objects are not displayed at all.

You can check this in the enclosed .zip.

Any idea ?





Link to comment
Share on other sites

It happens when I add the manager on creation complete event not on initialize event. But I have no choice.

Anybody ?



Link to comment
Share on other sites

I can't seem to even get your Flex files to compile - can you zip up a simple Flex project that demonstrates the problem and send it to me? (don't include the GreenSock files please). Sorry, I'm not much of a Flex guy.

Link to comment
Share on other sites

Ok, here a flash builder project.


(file removed for security purposes)

Link to comment
Share on other sites

Aha, I see the problem now. It has to do with yet another bug in Adobe's Flex framework. It incorrectly reports various properties on the Panel object you were using. For example, if you rotate it using the transform.matrix, it will visually change things appropriately but Flex won't update the width/height values that get reported in ActionScript. And its getBounds() reports a very different value altogether for width/height because it includes the drop shadow. See how much fun Flex can be? :x


Anyway, I spent a bunch of hours hacking together a solution that should give you what you need. In the latest version of TransformManager (posted today), there's a new "manualBoundsOffset" property of the TransformItem class that you can use to specifically tell it how much to offset things from the registration point as well as offset the width/height (optionally of course). In this example with the Panel, you'd probably want 0 offset on all the values so that it snaps to the registration point and uses the regular width/height that the Panel reports. That'll avoid the pesky drop shadow interference. Keep in mind that you should only need to use the manualBoundsOffset in very particular (rare) situations like this where the single selection box isn't being drawn correctly due to the Flex framework's bugs. So you can set the property directly like this:


var ti:TransformItem = _manager.addItem( l_object );
ti.manualBoundsOffset = new Rectangle(0, 0, 0, 0);


Go ahead and download the latest version from your GreenSock account at https://www.greensock.com/account/ and give it a shot. It seems to work great in the example you sent. And by the way, thank you for putting that together - it was VERY helpful in troubleshooting this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.