I’m trying to import a class that adds an instance of a a MovieClip multiple times, one below the other. I have used this type of loop before and it has worked fine. However, when I use it in an external class it seems to only disply the child added on last iteration.
Here is the code for the external class:
package classes {
import flash.display.*;
public class TheBox extends MovieClip{
var the_Box:MovieClip = new theBox();
public function TheBox () {
var a:int = 0
while ( a < 3 ) {
the_Box.y = a * the_Box.height;
addChild(the_Box);
a++;
}
}
}
}
Here’s the code for the flash poject:
import classes.TheBox;
var myBox:TheBox = new TheBox();
addChild(myBox);
Can anyone tell me why it only shows the child added on the last iteration of the loop?