my goal is to have multiple (animated) objects loaded in my stage as a movieclip trought an Array.
My current code:
var vijand:Array;
vijand = new Array ;
vijand.push(new Vijand(-580,-200));
vijand.push(new Vijand(-500,-200));
vijand.push(new Vijand(-420,-200));
for (var n:int = 0; n < vijand.length; n++)
{
this.addChild(vijand[n]);
}
//not working part. They do load on my stage. But I cant control the animation within the file(its a .SWF file I load)
for (var n:int = 0; n < vijand; n++){
gotoAndStop(1)
}
So basically my question is how can I get all these doing the animation with “gotoAndStop(1)” and or “gotoAndStop(2)”, so on and so on.
EDIT: the external file to load it, in Code
public function Vijand(positieX:int, positieY:int)
{
vijand = new Loader();
vijand.load(new URLRequest("resources/vijand.swf"))
this.addChild(vijand);
vijand.x = positieX;
vijand.y = positieY;
}
Is that what you need?
EDIT
Loaded SWF is a MovieClip. You need to access loader’s content. I am not sure how to call the variable as in your code you use
vijandfor an Array and for a Loader.Sample code: