PDA

View Full Version : how to createEmptyMovieClips



Gar_Fonz
June 17th, 2008, 10:18 PM
I haven't been able to figure out to how do what createEmptyMovieClip does in AS 2.0 in AS 3.0. The documentation says to use the new operator, but it doesn't have the same ability to create new names on the fly. Has anyone come up with a class or code that accomplishes dynamic naming?

TheCanadian
June 18th, 2008, 01:22 AM
var myMC:MovieClip = new MovieClip();

And if you wanna create a bunch:

var mc:MovieClip;
for(var i:int = 0; i < 3; i++) {
mc = new MovieClip();
mc.name = "myMC" + i;
}
And to access them:

getChildByName("myMC" + i);

But I would reccomend just storing them all in an array.

Gar_Fonz
June 18th, 2008, 01:42 AM
thanks alot, you helped me out of a jam - big time.

TheCanadian
June 18th, 2008, 02:20 AM
No prob :hoser: