Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

string to object bitmap conversion

Community Beginner ,
Apr 23, 2013 Apr 23, 2013

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);

TOPICS
ActionScript
707
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2013 Apr 23, 2013

what is "photo1"?

is that the class name of a bitmapdata object?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 23, 2013 Apr 23, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2013 Apr 23, 2013
LATEST

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines