flex---style和theme


1.<mx:Style source="style.css"/>
2.
<mx:Style>
.XXX{
  XXXX
}
</mx:Script>

3.在function里面写
list_yg.setStyle("backgroundColor","#FF00FF")

var css:CSSStyleDeclaration = new CSSStyleDeclaration("mystyle");
css.setStyle("color","blue");
css.setStyle("backgroundColor","green");
css.setStyle("fontSize",15);
StyleManager.setStyleDeclaration("Panel",css,true);//第三个参数是立即更新

全局样式:
在xx.css里面写一个
global{
 xxx

}
var css:CSSStyleDeclaration = StyleManager.getStyleDeclaration("global");

建议使用.swc来封装主题


在elipse里面找到Flex Compiler 里面找到Additional compoler arguments 加上 -theme ../Style/Smoke.css 
(这里Smoke.css在BindDemo1的src平级的Style文件夹下)

或者去Flex Builder3\sdks\3.00\frameworks\flex-config.xml中设置
<theme>
	<filename>themes/Smoke/Smoke.css</filename>
</theme>

如何生成swc文件
compc -include-file mycss.css c:/myfiles/themes/mycss.css 
    -include-file upIcon.jpg c:/myfiles/themes/assets/upIcon.jpg 
    -include-file downIcon.jpg c:/myfiles/themes/assets/downIcon.jpg 
    -include-file overIcon.jpg c:/myfiles/themes/assets/overIcon.jpg 
    -o c:/myfiles/themes/MyTheme.swc
或者写到配置文件里面
<?xml version="1.0"?>
<flex-config xmlns="http://www.adobe.com/2006/flex-config">
    <output>MyTheme.swc</output>
    <include-file>
        <name>mycss.css</name>
        <path>c:/myfiles/themes/mycss.css</path>
    </include-file>
    <include-file>
        <name>upIcon.jpg</name>
        <path>c:/myfiles/themes/assets/upIcon.jpg</path>
    </include-file>
    <include-file>
        <name>downIcon.jpg</name>
        <path>c:/myfiles/themes/assets/downIcon.jpg</path>
    </include-file>
    <include-file>
        <name>overIcon.jpg</name>
        <path>c:/myfiles/themes/assets/overIcon.jpg</path>
    </include-file>
    <include-classes>
        <class>MyButtonSkin</class>
        <class>MyAccordionHeaderSkin</class>
        <class>MyControlBarSkin</class>
    </include-classes>
</flex-config>

compc -load-config myconfig.xml

你可能感兴趣的:(C++,c,css,C#,Flex)