0

I am trying to use AS3 to call a series of linked bitmaps randomly. The bitmaps are all named "lines" + # so i created a variable to concatenate lines with a random number which works fine. The example below pulls the lines3 bitmap without issue but if i attempt to sub the lConstruct variable for lines3, it doesn't work. I know this is probably simple but i'm drawing a blank.

var lConstruct:String = ("lines" + RandNumGen())
var lTest:BitmapData=new lines3;
var bitmap1:Bitmap=new Bitmap(lTest);
addChild(bitmap1);
  • possible duplicate of [Can I create an instance of a class from AS3 just knowing his name?](http://stackoverflow.com/questions/7597343/can-i-create-an-instance-of-a-class-from-as3-just-knowing-his-name) – null Aug 06 '15 at 22:32
  • 1
    You can use `flash.utils.getDefinitionByName("CLassString") as Class` to get a reference to the class from a string – BadFeelingAboutThis Aug 07 '15 at 01:25

0 Answers0