flex動態載入swf皮膚

來源:互聯網
上載者:User

<?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"   creationComplete="initHandler(event)"><fx:Script><![CDATA[import flash.utils.clearTimeout;import flash.utils.setTimeout;import mx.events.FlexEvent;private var styleurl:String="";private var setTimeout2:uint;protected function initHandler(event:FlexEvent):void{styleurl="style01.swf";            styleManager.loadStyleDeclarations(styleurl,true);}protected function t1_clickHandler(event:MouseEvent):void{if(styleurl!=null){styleManager.unloadStyleDeclarations(styleurl,true);}styleManager.loadStyleDeclarations("style02.swf",true);styleurl="style02.swf";}protected function button1_clickHandler(event:MouseEvent):void{setTimeout2 = setTimeout(button1_click,2000);}private function button1_click():void{if(styleurl!=null){styleManager.unloadStyleDeclarations(styleurl,true);}styleManager.loadStyleDeclarations("style03.swf",true);styleurl="style03.swf";clearTimeout(setTimeout2);}protected function button2_clickHandler(event:MouseEvent):void{// TODO Auto-generated method stubif(styleurl!=null){styleManager.unloadStyleDeclarations(styleurl,true);}styleManager.loadStyleDeclarations("style01.swf",true);styleurl="style01.swf";}]]></fx:Script><fx:Declarations><!-- 將非可視元素(例如服務、值對象)放在此處 --></fx:Declarations><s:Panel horizontalCenter="0" y="100" width="422" height="300" title="使用者登入"><s:layout>     <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" gap="28"/></s:layout><s:HGroup verticalAlign="middle"><s:Label text="使用者名稱"/><s:TextInput id="t1" styleName="textInput" prompt="請輸入使用者名稱"/></s:HGroup><s:HGroup verticalAlign="middle" paddingLeft="20"><s:Label text="密碼" id="t2"/><s:TextInput styleName="textInput" prompt="請輸入密碼"/></s:HGroup><s:controlBarContent><s:Button label="小粉紅" click="t1_clickHandler(event)" color="0xFF00FF"/><s:Button label="經典藍(2秒)" click="button1_clickHandler(event)" color="0x4169E1"/><s:Button label="青草綠(預設)" click="button2_clickHandler(event)" color="0x00FF00"/></s:controlBarContent><s:controlBarLayout><s:HorizontalLayout gap="39"/></s:controlBarLayout></s:Panel></s:Application>

/* CSS file */@namespace s "library://ns.adobe.com/flex/spark";@namespace mx "library://ns.adobe.com/flex/mx";global{color:#dc143c;fontFamily:"微軟雅黑";borderColor:#caff70;fontSize:20;borderWeight:3;}s|Panel{backgroundColor:"#00FF00";backgroundAlpha:0.3;}s|TextInput{color:#ff0000;fontFamily:"微軟雅黑";borderColor:#ffff00;fontSize:20;}s|Button{    paddingleft:"10";paddingtop:"5";}.textInput{color:#cd8500;fontFamily:"微軟雅黑";borderColor:#ff0000;fontSize:20;}#t1{color:#00ff00;fontFamily:"微軟雅黑";borderColor:#0000ff;fontSize:20;}#t2{color:#0000ff;fontFamily:"微軟雅黑";borderColor:#ff00ff;fontSize:20;}

/* CSS file */@namespace s "library://ns.adobe.com/flex/spark";@namespace mx "library://ns.adobe.com/flex/mx";global{color:#191970;fontFamily:"微軟雅黑";borderColor:#caff70;fontSize:20;borderWeight:3;}s|Panel{backgroundColor:"#E066FF";}s|TextInput{fontFamily:"微軟雅黑";borderColor:#ffff00;fontSize:20;}.textInput{fontFamily:"微軟雅黑";borderColor:#ff0000;fontSize:20;}#t1{color:"#00FFFF";fontFamily:"微軟雅黑";borderColor:#0000ff;fontSize:20;}

/* CSS file */@namespace s "library://ns.adobe.com/flex/spark";@namespace mx "library://ns.adobe.com/flex/mx";global{color:"#388E8E";fontFamily:"微軟雅黑";borderColor:#caff70;fontSize:20;borderWeight:3;}s|Panel{backgroundColor:"#00B2EE";}s|TextInput{fontFamily:"微軟雅黑";borderColor:#ffff00;fontSize:20;}.textInput{fontFamily:"微軟雅黑";borderColor:#ff0000;fontSize:20;}#t1{color:"#6B8E23";fontFamily:"微軟雅黑";borderColor:#0000ff;fontSize:20;}


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.