for loop - Actionscript 3. Remove loader with a for -
i have loader want remove, , instead of removing 1 one
removechild(imgloader1); removechild(imgloader3); removechild(imgloader4); removechild(imgloader5); removechild(imgloader6);
i want remove them loop, this
for(i=1; i<=6; i++) { removechild(imgloader[i]); }
but not working because isn't uniting imgloader[i]
, making imgloader1..2..3
give try:
//define global image loader array going store references var imageloaders:array = []; var imageloader:imageloader = new imageloader(); var image:urlrequest = new urlrequest("http://server.com/myimage.gif"); imageloader.load(image); //store reference later use... imageloaders.push(imageloader); // add stage addchild(imageloader); // , later remove image loaders stage for(var i:int = 0; < imageloaders.length; i++) { removechild(imageloaders[i]); }
hope helps
Comments
Post a Comment