Jump to content
Search Community

best way to add bounds() to dynamic clips?

danno test
Moderator Tag

Recommended Posts

how would i add a transform item, with its own set of unique set of bounds for movement, to a dynamically created MC on the stage.

 

i'll have multiple sets of dynamically created MC's, but just need to know how i would go about:

a) limiting it's movement to a certain rectangle boundaries ( don't care about the scale or rotation though )

B) adding those restrictions for each MC on stage, which each MC will need to have its own set of bounds, which will be different than the other MC's on the stage.

 

what would be the best way to accomplish this? thanks!

Link to comment
Share on other sites

just to make sure, something like this:

 

var managerOne:TransformManager = new TransformManager({
  bounds: new Rectangle(0, 0, 50, 50)
})
var itemOne:TransformItem = managerOne.addItem(mcOne);

var managerTwo:TransformManager = new TransformManager({
  bounds: new Rectangle(0, 0, 100, 100)
})
var itemTwo:TransformItem = managerTwo.addItem(mcTwo);

 

and so on for any remaining ones. correct?

thanks!

Link to comment
Share on other sites

  • 2 weeks later...

quick follow up/addition:

let's say that i have a MC on the stage, and i would normally reference it like this:

 

largeHolderMC.mediumHolderMC.itemToBeTransformItemMC

 

i will be wanting to have itemToBeTransformItemMC be the movieclip that i add to a TransformManager. but i will want to have bounds set for the manager that controls itemToBeTransformItemMC.

the issue i want to know is how do i ensure that if i have itemToBeTransformItemMC still with the correct bounds inside mediumHolderMC(which is inside of largeHolderMC) and i scale largeHolderMC to 50% of it's original size, that the itemToBeTransformItemMC has the bounds still in place, even though it's new size will be 50% of it's original size.

 

i hope that you understand what i mean. let me know if you need more explanation.

 

thanks!

Link to comment
Share on other sites

scaling the container (parent) clip won't have any affect on the children or the TransformManager instance that is managing them. The bounds are always relative to the item's parent (in this case mediumHolderMC). That's how Flash treats everything - kinda like if you scale a clip to a scaleX/scaleY of 0.5 and then you scale the parent to 0.5. If you then check the children's scaleX/scaleY they still report 0.5, not 0.25.

 

Make sense?

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.
×
×
  • Create New...