Share Posted September 1, 2009 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 ) 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 More sharing options...
Share Posted September 1, 2009 AS2 or AS3? Link to comment Share on other sites More sharing options...
Author Share Posted September 1, 2009 as3 Link to comment Share on other sites More sharing options...
Share Posted September 1, 2009 bounds are meant to apply to TransformManagers, so if you want to have different bounds for your various items, you'd need to create multiple TransformManager instances (one for each). Link to comment Share on other sites More sharing options...
Author Share Posted September 2, 2009 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 More sharing options...
Share Posted September 2, 2009 Yep, except I think you had a typo - it should be managerOne.addItem() and managerTwo.addItem(), not mgr.addItem() for both. Link to comment Share on other sites More sharing options...
Author Share Posted September 2, 2009 ... think you had a typo - it should be managerOne.addItem() and managerTwo.addItem(), not mgr.addItem() for both. updated above to reflect correct example correct? Yep awesome, thanks! Link to comment Share on other sites More sharing options...
Author Share Posted September 12, 2009 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 More sharing options...
Share Posted September 12, 2009 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 More sharing options...
Author Share Posted September 12, 2009 ok cool. just wanted to make sure before i test it out if there was any problems with that. thanks again for the fast response! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now