Jump to content
Search Community

initParent & initStage : Re-use the same instance

vincent test
Moderator Tag

Recommended Posts

Hi,

 

Imagine the following scenario:

 

Elem A with Parent X

Elem B with Parent Y

 

var manager:TransformManager = new TransformManager();
manager.addItem(elemA);

Ok, now transform manager is initialized with Parent X (onTargetAddedToStage function).

manager.removeItem(elemA);
/* There are more elements in the transform manager */
manager.addItem(elemB);

The stage has now changed (Parent X != Parent Y) but it does not pass again in the initialization function.

 

The simple workaround is to re-instantiate the Transform manager but it would be cool to keep the same instance.

What do you think?

 

Thanks

Link to comment
Share on other sites

Yeah, once you've instantiated a TransformManager and added the first item, the parent is determined but if you're going to manage things in another parent, you'll need to create a different TransformManager instance. Maybe I'll restructure things and create an invalidate() method or something in the future but that's not a simple tweak :)

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...