flex動(dòng)態(tài)加載swf皮膚示例代碼
更新時(shí)間:2013年09月26日 17:34:32 作者:
動(dòng)態(tài)加載swf皮膚,對(duì)經(jīng)常使用flex的朋友來(lái)說(shuō)并不陌生,在本文為大家詳細(xì)介紹下具體的實(shí)現(xiàn)方法,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:
<?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 stub
if(styleurl!=null)
{
styleManager.unloadStyleDeclarations(styleurl,true);
}
styleManager.loadStyleDeclarations("style01.swf",true);
styleurl="style01.swf";
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 將非可視元素(例如服務(wù)、值對(duì)象)放在此處 -->
</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="請(qǐng)輸入用戶名"/>
</s:HGroup>
<s:HGroup verticalAlign="middle" paddingLeft="20">
<s:Label text="密碼" id="t2"/>
<s:TextInput styleName="textInput" prompt="請(qǐng)輸入密碼"/>
</s:HGroup>
<s:controlBarContent>
<s:Button label="小粉紅" click="t1_clickHandler(event)" color="0xFF00FF"/>
<s:Button label="經(jīng)典藍(lán)(2秒)" click="button1_clickHandler(event)" color="0x4169E1"/>
<s:Button label="青草綠(默認(rèn))" click="button2_clickHandler(event)" color="0x00FF00"/>
</s:controlBarContent>
<s:controlBarLayout>
<s:HorizontalLayout gap="39"/>
</s:controlBarLayout>
</s:Panel>
</s:Application>
復(fù)制代碼 代碼如下:
/* 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;
}
復(fù)制代碼 代碼如下:
/* 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;
}
復(fù)制代碼 代碼如下:
/* 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;
}
相關(guān)文章
Flex中通過(guò)RadioButton進(jìn)行切換示例代碼
這篇文章主要介紹了Flex中通過(guò)RadioButton進(jìn)行切換示例代碼,需要的朋友可以參考下2014-02-02Flex中的HDividedBox和VDividedBox的比較附圖
學(xué)習(xí)Flex的朋友對(duì)HDividedBox和VDividedBox并不陌生吧,下面是兩者的簡(jiǎn)單比較,感興趣的朋友可以參考下2013-10-10Flex Label控件豎排顯示文字的實(shí)現(xiàn)代碼
Label控件豎排顯示文字一般都是橫排的,接下來(lái)為大家分享個(gè)方法讓它變成豎排,感興趣的童鞋們可以學(xué)習(xí)下,希望對(duì)你有所幫助2013-04-04Flex讀取txt文件中的內(nèi)容報(bào)錯(cuò)原因分析及解決
這篇文章主要介紹了Flex讀取txt文件中的內(nèi)容報(bào)錯(cuò)原因分析及解決,需要的朋友可以參考下2014-05-05datagrid不可編輯行有關(guān)問(wèn)題的控制方法
datagrid不可編輯行一個(gè)更簡(jiǎn)單的辦法,editable=“true”,然后直接把itemEditBegin給停掉阻止createItemEditor的調(diào)用2014-01-01flex 遍歷Object對(duì)象內(nèi)容的實(shí)現(xiàn)代碼
這篇文章主要介紹了flex 遍歷Object對(duì)象內(nèi)容的實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-07-07Flex 自定義DataGrid實(shí)現(xiàn)根據(jù)條目某一屬性值改變背景顏色
本節(jié)主要介紹了Flex DataGrid根據(jù)條目某一屬性值改變背景顏色,此DataGrid為自定義拓展的,需要的朋友可以參考下2014-07-07Flex實(shí)現(xiàn)雙軸組合圖的設(shè)計(jì)思路及代碼
組合圖是有柱狀圖和折線圖組合的,柱狀圖顯示的數(shù)據(jù)是依據(jù)左邊的豎直軸,折線圖的數(shù)據(jù)依據(jù)右邊的豎直軸,詳細(xì)實(shí)現(xiàn)請(qǐng)看本文,希望對(duì)大家有所幫助2013-09-09