Posted By

arpo on 05/26/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

abbey


Dynamicly load an image from the library witha a class name from a variable.


 / Published in: ActionScript 3
 

  1. import flash.display.Bitmap;
  2. import flash.display.BitmapData;
  3. import flash.utils.getDefinitionByName;
  4.  
  5.  
  6. var logoSmall:Bitmap = new Bitmap();
  7. var classDefinition:Class = getDefinitionByName("logo1.png") as Class;
  8. var img:BitmapData = new classDefinition(1,1);
  9. logoSmall.bitmapData = img;
  10. addChild(logoSmall);

Report this snippet  

You need to login to post a comment.