The code is somewhat similar in Flex 1 .5 and Flex 2 - something like this:
http://webmxml.no-ip.info/flextraining/button_icon_examples.htm (link to the code below) Flex 1.5 Code Snippet: <mx:Script> <![CDATA[ [Embed("images/pause.gif")] var imgPause:String; [Embed("images/play.gif")] var imgPlay:String; ]]> </mx:Script> <mx:Button id="btnMute" label="Mute" icon="{(btnMute.label=='Mute')?imgPause:imgPlay}" enabled="true" toolTip="Mute the music..." /> Flex 2 Code Snippet: <mx:Script> <![CDATA[ [Bindable] private var imgPauseClass:Class; [Bindable] private var imgPlayClass:Class; [Embed(source="images/pause.gif")] [Embed(source="images/play.gif")] ]]> </mx:Script> <mx:Button id="btnMute" label="Mute" labelPlacement="left" icon="{(btnMute.label=='Mute')?imgPauseClass:imgPlayClass}" enabled="true" toolTip="Mute the music..." /> Hope this helps. --- In [email protected], "aks.agni" <[EMAIL PROTECTED]> wrote: > > Hi all, > > How we can load the image in the icon property of the Button > at run time. > > > Thanks in advance. >
