I don't know what I was smoking, but my solution actually works as I'd expect.

The following works (I was just off a bit in my syntax):
var icon1:Class = getDefinitionByName("icon1") as Class;
var currentIcon:Object =  icon1 as Object;      

--- In flexcoders@yahoogroups.com, "Todd" <tpreka...@...> wrote:
>
> I have a long list string to graphic class mappings that are contained within 
> a gigantic switch statement:
> 
> case "icon_1":
>   selectedIcon = icon_1;
>   break;
> case "icon_2":
>   selectedIcon = icon_2;
>   break;
> 
> I'm looking for a way to get an instance of an Class reference based on a 
> string.  I'm not looking to create a NEW instance, however.
> 
> For example, I'm NOT looking to do this:
> var icon_1:Class = getDefinitionByName("icon_1") as Class;
> selectedIcon = new icon_1();
> 
> I've tried some simple things like, but without results:
> selectedIcon = Class("icon_1");
> 
> Any suggestions for the syntactical shortcut that I'm looking for? 
> 
> Thanks
>


Reply via email to