This can help:
Flex supports external CSS stylesheets. To apply a stylesheet to the current document and its child documents, use the source property of the tag. External style table files must be located in the folder containing the MXML source files. By default, this is the src folder in your MXML project.
Note. You should try to limit the number of stylesheets used in the application and set the stylesheet only in the top-level document in the application (the document containing the tag). If you set a stylesheet in a child document, unexpected results may occur.
The following example defines two CSS class selectors in an external CSS file called external.css. You are using an external CSS file in your Flex application by specifying its path and file name in the original tag property. Example: External CSS File
.solidBorder { borderStyle: "solid"; } .solidBorderPaddedVertically { borderStyle: "solid"; paddingTop: 12px; paddingBottom: 12px; }
MXML file
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="150" height="140" viewSourceURL="src/StylesExternal/index.html" > <mx:Style source="styles/external.css" /> <mx:VBox styleName="solidBorder"> <mx:Button label="Submit"/> </mx:VBox> <mx:VBox styleName="solidBorderPaddedVertically"> <mx:Button label="Submit"/> </mx:VBox> </mx:Application>
source share