Home Tutorial Flex Flex4 Components External style sheets in Flex4

 
 

External style sheets in Flex4
Posted on: June 21, 2010 at 12:00 AM
Advertisement
In this example you can see how we can use external style sheet.

External style sheets in Flex4:

In this example you can see how we can use external style sheet. You can choose a CSS file and set the properties of components in it. After that you call this style sheet in to main application.

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<!-- call external style sheet using source property-->

<fx:Style source="externalstyle.css"/>

<s:Panel title="External Style Example" width="288" height="182">

<s:Button id="btn"

label="Submit"

styleName="button"

x="103" y="28"/>

<s:Label text="This is a external style example."

x="22" y="84"

styleName="label"/>

</s:Panel>

</s:Application>

externalstyle.css

/* CSS file */

@namespace s "library://ns.adobe.com/flex/spark";

@namespace mx "library://ns.adobe.com/flex/mx";

.button{

font-family:"Verdana";

font-size:14px;

text-align:center;

color:#990000;

font-weight:bold;

}

.label{

font-family:"Verdana";

font-size:14px;

font-weight:bold;

color:blue;

}

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Download externalstyle.css file code

Advertisement

Related Tags for External style sheets in Flex4:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 21, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com