简体   繁体   中英

loading images in swf as3

Because I have 24 movie clips and i need to load in every one of them different picture. So my question is, is there a really simple way to do that with as3 ? I need to call the pictures from different source?

This is what I would use:

var imagesCollection:Array = new Array("image1.jpg","image2.jpg","image3.jpg");
for(var i:int=0; i<imagesCollection.length; i++){
    var request:URLRequest = new URLRequest(imagesCollection[i]);
    var loader:Loader = new Loader();
    loader.load(request);
    addChild(loader);
};

Make sure to import URLRequest and Loader at the top of the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM