lundi 29 juin 2015

dynamic loading images by name from library

i have a small problem with loading specific images in flash...

In my project I want to load a certain image from the library (f.ex. "event1_pic.jpg") - the actual number is stored in an int variable.

I already exported the jpg for actionscript and it works fine when i directly call the image by its full name...

That's the current working solution (calling the full name of the image) :

var event_pic = new event1_pic();
bmp = new Bitmap(event_pic);
addChild(bmp);

My attempt on integrating the int variable in the name (event_number=1):

var event_pic = new this["event"+event_number+"_pic"]();
big_pic = "event"+event_number+"_pic";
var event_pic = new this.big_pic();  

Can anyone please help me with that problem? Or maybe anyone knows another solution on loading specific images that only differ in name?

Aucun commentaire:

Enregistrer un commentaire