Flex CSS control-by StyleManager class

来源:互联网 发布:marc dorcel 知乎 编辑:程序博客网 时间:2024/04/29 16:05
global selector can also be defined through the StyleManager class
In the example, the same properties defined with the CSS global selector will be applied,this time using the ActionScript StyleManager class.
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initStyle();"><!--don't forget to add creationComplete="initStyle();" so that the private function initStyle()can assicate with event--><mx:Script><![CDATA[import mx.styles.StyleManager;private function initStyle():void {// Global style: applies to all controls.StyleManager.getStyleDeclaration("global").setStyle("fontSize",12);StyleManager.getStyleDeclaration("global").setStyle("fontStyle","italic");StyleManager.getStyleDeclaration("global").setStyle("fontWeight","bold");StyleManager.getStyleDeclaration("global").setStyle("textDecoration", "underline");StyleManager.getStyleDeclaration("global").setStyle("fontFamily","Arial");}]]></mx:Script><mx:Panel x="101" y="79" width="250" height="200" layout="absolute"></mx:Panel><mx:Text x="374.5" y="123" text="1111" width="111" height="40"/></mx:Application>
原创粉丝点击