Monday, August 31, 2009

Embed CSS at run time in FLEX and AIR

Step 1:

Create a CSS file named main.css.


/* CSS file */

Label
{
font-size : 25;
}

Step 2:
Right click on CSS file and click 'compile CSS to SWF'.//The main,swf will create in the bin-debug folder

Step 3:
</?xml version="1.0" encoding="utf-8"?>

</mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()">

</mx:Script>
</![CDATA[
private function creationCompleteHandler():void
{
StyleManager.loadStyleDeclarations('main.swf');
}
]]>
<//mx:Script>
</mx:Label text="CSS loads dynamically"/>
<//mx:Application>


Thanks
R.Bhatia

No comments:

Post a Comment