Hi,

not directly, you need to embed the resource and assign a name to it:

  // somewhere in you code
  [Embed("test.gif")]
  public var testIcon:String;

this makes the resource available through the testIcon identifier. Later
on you can assign the icon by doing

  myButton = myComp.createChild(mx.controls.Button, "cancelButton",
{label: "Cancel", icon: testIcon});

Cheers,
Dirk.

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of r_woess
Sent: Thursday, October 13, 2005 10:35 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Adding Icons with Actionscript

Hi,

I want to add an icon to a button at runtime. 

I watched the generated as-File and the button <mx:Button
icon="@Embed('test.gif')"/> was generated to this code:

new mx.core.UIObjectDescriptor({ type: mx.controls.Button, id: Button7",
_properties: function() { return { icon:
"__Resources.0967270563.Palfinger_Rhino_2_jpg" }; }}),


Is there a possibility to add icons like this?:
myButton=myComp.createChild(mx.controls.Button, "cancelButton",
{label: "Cancel", icon:"@Embed('test.gif')"});


best regards
reini





------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links



 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to