AS2 loop through all the movie clips on the stage

Here is a quick way to get and set properties for all movie clips on the stage without having to know the instance names of each MovieClip.

for (var prop in this) {
if (this[prop] instanceof MovieClip) {
mc = this[prop];
trace ("test name: " + mc._name + " mc._x:" + mc._x + " a: " + mc._alpha);
}
}

Flash AS3 onEnterFrame event changed

Actionscript 3.0 onEnterFrame has changed a bit from the old classic AS2 onEnterFrame event function. I’ll illustrart the old and new way of preforming animations using the Enter Frame event. Continue Reading »

Loop through child movie clips in AS3 and AS2

To iterate through all children in a display object container…

ActionScript 3 Code Sample:

for(var i=0; i<mcContainer.numChildren-1; i++) { 
var mc:MovieClip = MovieClip(mcContainer.getChildAt(i)); 
mc.doStuff(); 
}

ActionScript 2 Code Sample:

for (var Item in Parent) {
	if (typeof (Parent[Item]) == "movieclip") {
		Parent[Item].doSomething();
	}
}