We can use a loop to control all of the children of a movie or movie clip, or just those with certain characteristics.

In this example, there are several movie clips on the stage: 2 movie clips (blue circles), and 3 stars that are instances of the Spinner class.

Get Adobe Flash player

When we click the button, we use ActionScript to set the x value of all instances of the Spinner class to 200.

btnGo.label="Click me";
btnGo.addEventListener(MouseEvent.CLICK, goSpinner);
function goSpinner(event:MouseEvent):void {
  var i:int;
  var d:DisplayObject;
  for(i=0;i<this.numChildren;i++) {
	if(d is Spinner)	d.x=200;

Notice that only the intances of the spinner class change position.

Download the movie

NEXT: Spinning Stars