Jump to content


Problem with bounds on TransformItem [SOLVED]

Recommended Posts



I started using the TransformManager today and it is mostly working exactly how it should be.

There is however one thing that behaves oddly: the bounds property of a TransformItem.


Short example:

Stage with one MovieClip named 'rect_mc'

var mgr:TransformManager = new TransformManager({
bounds: new Rectangle(0, 0, 550, 400)
var item:TransformItem = mgr.addItem(rect_mc);
item.bounds = new Rectangle(0, 0, 200, 200);


I would expect rect_mc to move only inside the item.bounds box, but actually I can drag it all over the mgr.bounds box.

When I drag rect_mc outside the mgr.bounds, it will suddenly get restricted to the item.bounds.


I tried to set the mgr.bounds to (0,0,0,0) but then sometimes rect_mc behaved strangly (thinking it should fit in those bounds).


Am I doing something wrong or should I implement the bounds differently?

(I compile with Flash CS4 using AS3)


Thanks in advance

Link to comment
Share on other sites

Sorry for the confusion - I should have made a note in the ASDocs that the bounds of TransformItems should match the bounds of their TransformManager. I'll make that note and post with the next rev. Allowing each TransformItem to have different bounds would degrade performance because on each MOUSE_MOVE, it would have to check for violations of bounds on each selected item. Plus I'd definitely consider it an edge case - when a developer imposes bounds it's virtually always on a TransformManager basis, not TransformItem. You could create a TransformManager instance for each set of bounds if you prefer.


Thanks for pointing out the discrepancy - I'll make the note in the docs and remove the "bounds" property from the TransformItem ASdocs.

Link to comment
Share on other sites

Thanks for the fast response.


I was already thinking that if the bounds could be specified per item it would become very complicated :D

Maybe it could work if you only let the user select items (simultaniously) with the same bounds, but then again, it isn't much work to do that yourself by making different managers (like you said).


Thanks again!

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.