Ahh right ;) Thanks for the info. Best,
Berkay UNAL [email protected] On Tue, Dec 16, 2008 at 20:36, Alex Harui <[email protected]> wrote: > Icon_usd is not the name of the class, it is a variable referencing the > class (what would be returned from getDefinition) > > > > You can try: > > > > var classRef:Class = this["icon_" + value] > > > > From: [email protected] [mailto:[email protected]] On > Behalf Of Berkay Unal > Sent: Tuesday, December 16, 2008 9:23 AM > To: [email protected] > Subject: [flexcoders] Dynamic variable for embed image classes? > > > > Hi, > > I am trying to get the icons that are embeded with a dynamic variable. > > For ex: ikon("usd"); > > But cannot make it work. Any ideas? > > //SRC > > [Embed("images/eur.png")] > private var icon_EUR:Class; > > [Embed("images/usd.png")] > private var icon_usd:Class; > > [Embed("images/chf.png")] > private var icon_CHF:Class; > > public function ikon(value:String):Class { > var t:String = "icon_"+value; > var classRef:Class = getDefinitionByName(t) as Class; > return new classRef(); > } > > Best, > > Berkay UNAL > [email protected] > >

