Bind icon to class : Icon « Graphics « Flex






Bind icon to class

Bind icon to class
  
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">

    <mx:Script>
        
            [Bindable]
            [Embed(source="a.png")]
            private var Icon:Class;
      
    </mx:Script>

    <mx:Button label="[Embed(source='a.png')]" icon="{Icon}" />
    <mx:Button label="@Embed('a.png')" icon="@Embed('a.png')" />

</mx:Application>

   
    
  








Related examples in the same category

1.Use iconFunction to determine the icon to displayUse iconFunction to determine the icon to display
2.Set the default leaf icon to null to hide it, and uses custom icons for the folder open and closed iconsSet the default leaf icon to null to hide it, and uses custom icons for the folder open and closed icons
3.Adding an icon to the buttonAdding an icon to the button