actionscript 3 - AS3 how to access movieclip from a child added in runtime -


I have created a child that will be added on runtime How do I watch movie clips from inside the main place of children?

The best practice is already referenced from the container of both the child, on stage clips

  this.myAddedClip.otherStageClip = this.alreadyOnStageClip;   

It avoids hardcoding structural information in a child case, which is an object-oriented no-no, and usually leads to spaghetti code.

As a rule of thumb object, usually only "know" about your direct children.

As you can see from this example that the child object still ends in the context of another, but there is no need to know that it is already on stage, or its original object etc. is.

Comments