Copy link to clipboard
Copied
Hello:
How can I convert a string to an object bitmap?
Thank you.
With this I get error:
var f1:String ="photo1";
var img:Object=f1;
var foto1:BitmapData = new img(0,0);
var foto1_stage:Bitmap = new Bitmap(foto1);
Copy link to clipboard
Copied
what is "photo1"?
is that the class name of a bitmapdata object?
Copy link to clipboard
Copied
I mistake an error.
I have in the library:
Photo1
Photo2
Photo3
etc,
linked to actionscript
I need to convert string "Photo"+ 1 to an object
I need to convert string "Photo"+2 to an object
Copy link to clipboard
Copied
use:
var c:Class=Class(getDefinitionByName("Photo1"));
var c:*=new c();
// and, if those are bitmapdata class objects, possibly:
var bmp:Bitmap=new Bitmap(c);
addChild(bmp)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now