There is a getDefinitionByName() function (not method) in the
flash.utils package which will give you a Class reference if you give it
a fully qualified class name like "mx.controls.Button".
 
However, if the class doesn't actually exist in your application or in
the Player, it will return null. So you must ensure that classes you
want to look up by name actually get linked in. A common way to do that
is to declare a static var of that type, even if you don't use this var.
 
Gordon Smith
Adobe Flex SDK Team

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of polestar11
Sent: Wednesday, December 19, 2007 4:05 AM
To: [email protected]
Subject: [flexcoders] Any way to cast a string reference of a class name
to its Class equivallent



Hi there

I have a list of class names stored as strings in an xml file. 
Is there any way to cast them to actual class items programatically
once the file has loaded.

Eg. 
<item classname="aClass"/>

// in code
myComponent.setStyle("icon", Class([EMAIL PROTECTED]));

Cheers
Tracy



 

Reply via email to