Kircho
Kircho

Reputation: 71

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?

Upvotes: 0

Views: 160

Answers (1)

Michael
Michael

Reputation: 325

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.

Upvotes: 1

Related Questions