Arrays as "movieclip" actionscript 3.0 -
my goal have multiple (animated) objects loaded in stage movieclip trought 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)); (var n:int = 0; n < vijand.length; n++) { this.addchild(vijand[n]); } //not working part. load on stage. cant control animation within file(its .swf file load) (var n:int = 0; n < vijand; n++){ gotoandstop(1) }
so question how can these doing animation "gotoandstop(1)" , or "gotoandstop(2)", on , on.
edit: external file 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 need?
var vijand:array; vijand = new array ; vijand.push(new vijand(-580,-200)); vijand.push(new vijand(-500,-200)); vijand.push(new vijand(-420,-200)); (var n:int = 0; n < vijand.length; n++) { this.addchild(vijand[n]); movieclip(vijand[n]).gotoandstop(1); //or gotoandplay(1) - depending on needs }
edit
loaded swf is movieclip. need access loader's content. not sure how call variable in code use vijand
array , loader.
sample code:
var mymovieclip:movieclip; var loader:loader = new loader(); loader.contentloaderinfo.addeventlistener(event.complete, onloaded); loader.load(new urlrequest("resources/vijand.swf")); function onloaded(e:event):void { mymovieclip = movieclip(loader.content); mymovieclip.gotoandstop(1); //you can add movieclip array , on... }
Comments
Post a Comment