You can't do oPage:Page since you don't know it is a Page.  If you know
the common base class or interface for all possible objects you can use
that type or, of course, Object,

 

If obj.className == "Page" and you want to create one, you use
getDefinition or getDefinitionByName and new()

 

Var c:Class =
ApplicationDomain.currentDomain.getDefinition(obj.className);

oPage = new c();

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Toby Tremayne
Sent: Sunday, April 08, 2007 7:38 PM
To: [email protected]
Subject: [flexcoders] dynamic creation of class

 

Hi all,

            

            I have a method which retrieves an actionscript object, and
depending on the value of one of the keys, converts it into an
actionscript class.  The issue I have is I don't know how to instantiate
a class whose name 

I can't hard code - can anyone help me with this?

 

            Basically the idea is that if obj.classname = "Page"  then I
need to write oPage : Page = new Page();  dynamically.  Is there any way
to do this in actionscript?

 

Toby

 

 

-----------------------------------

 

                Life is poetry, write it in your own words

 

-----------------------------------

 

Toby Tremayne

Senior Technical Consultant

Lyricist Software

0416 048 090

ICQ: 13107913





 

 

Reply via email to