PDA

View Full Version : Create movieclip descendants with Actionscript?


mxyntl
09-30-2009, 10:54 PM
Anyone know if movieclips can be created inside of other movieclips using AS2?

I like to keep all of my AS in one place instead of adding some of it to movieclips in the library.

mxyntl
10-01-2009, 02:55 PM
Well I guess it's not such a smart question.
I think this is it... it works at least.


// with "ball" in library
var MC1_mc:MovieClip;
MC1_mc = this.attachMovie("ball", "ball", getNextHighestDepth());
var MC2_mc:MovieClip;
MC2_mc = this.attachMovie("MC1_mc", "MC1_mc", getNextHighestDepth());
var MC3_mc:MovieClip;
MC3_mc = this.attachMovie("MC2_mc", "MC2_mc", getNextHighestDepth());