Using SWF files as skins

You can use SWF files as skins. You can use the entire SWF file as a single skin, or you can use one or more symbols inside the SWF file as a skin. To embed an entire SWF file, you point to the location of the SWF file with the source property in the Embed statement, as follows:

<?xml version="1.0"?>
<!-- skins/EmbedSWFSource.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Style>
     Button {
        upSkin: Embed(source="../assets/SubmitButtonUpSkin.swf");
     }
  </mx:Style>
  <mx:Button id="b1"/>
</mx:Application>

To import a symbol from a SWF file, you use the symbol property to specify the symbol name that you want to use in addition to pointing to the location of the SWF file with the source property. You must separate each attribute of the Embed statement with a comma.

The following example replaces the Button control's upSkin property with an entire SWF file, but the overSkin and downSkin properties with individual symbols from a second SWF file:

<?xml version="1.0"?>
<!-- skins/EmbedSymbolsCSS.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Style>
     Button {
        upSkin: Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyUpSkin');
        overSkin: Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyOverSkin');
        downSkin: Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyDownSkin');
     }
  </mx:Style>
  <mx:Button id="b1"/>
</mx:Application>

You use the same syntax when embedding skin symbols inline, as follows:

<?xml version="1.0"?>
<!-- skins/EmbedSymbolsInline.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Button id="b1" 
     overSkin="@Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyOverSkin')"
     upSkin="@Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyUpSkin')"
     downSkin="@Embed(source='../assets/SubmitButtonSkins.swf', symbol='MyDownSkin')"
  />
</mx:Application>

In the source FLA file, all symbols that you use must meet the following conditions:


Flex 2.01

Take a survey