flex动态加载swf皮肤示例代码

所属分类: 网络编程 / Flex 阅读数: 1969
收藏 0 赞 0 分享
复制代码 代码如下:

<?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>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</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;
}
更多精彩内容其他人还在看

Flex控制弹出窗口拖动范围示例代码

使用TilteWindow形式的弹出窗口发现有时候一不小心将窗口拖动到上面就拖不回来了,导致弹出窗口无法关闭,下面有个解决方法
收藏 0 赞 0 分享

Flex中通过RadioButton进行切换示例代码

这篇文章主要介绍了Flex中通过RadioButton进行切换示例代码,需要的朋友可以参考下
收藏 0 赞 0 分享

获取到AdvancedDataGrid选中行的全部数据

通过AdvancedDataGrid的id来获取selectedItem和selectedItems属性,下面有个不不错的示例大家可以参考下
收藏 0 赞 0 分享

flex是什么 Flex介绍

Flex 是一个高效、免费的开源框架,可用于构建具有表现力的 Web 应用程序,这些应用程序利用 Adobe Flash Player和 Adobe AIR, 运行时跨浏览器、桌面和操作系统实现一致的部署
收藏 0 赞 0 分享

Flex3 DataGrid拖拽到ClumnChart动态显示图表实现代码

Flex3 DataGrid拖拽到ClumnChart动态显示图表(支持多行同时拖拽,重复数据不重得添加,添加了图表右键菜单)等等,感兴趣的朋友可以了解下啊,或许对你有所帮助
收藏 0 赞 0 分享

Flex 基于数据源的Menu Tree实现代码

由外部参数flashvars指定数据源的文件位置或render链接,在源数据上加href和target属性来控制打开窗口,可自定义父节点和子节点图标,不设置采用系统默认,感兴趣的你可以了解下啊,或许对你有所帮助
收藏 0 赞 0 分享

flex与js通信与彼此之间的互调整理(一)

需要使用flex调用js来操控用ajax做的三维球,开始网上查找flex和js之间互相调用的范例,这里整理一下也避免忘记,感兴趣的朋友可以了解下,或许对你有所帮助
收藏 0 赞 0 分享

flex与js通信与彼此之间的互调整理(二)

之前写了一篇flex和js之间的通信,还记得最开始研究这两门语言如何交互,一晃我的任务也快做完了,就把项目打一下包,感兴趣的朋友可以参考下,或许对你学习flex有所帮助
收藏 0 赞 0 分享

Flex帮助文档(chm格式)制作及FAR的使用

如何将自己的flex项目提取里面的注释生成网页形式的帮助文档,现在也比较流行这种方式,好像flex里面不能直接生成chm的文档,这里推荐FAR以及RoboHelp,不过RoboHelp破解版不好找,并且英文版的,我也不是怎么懂,还是FAR方便一些,感兴趣的朋友可以了解下
收藏 0 赞 0 分享

Flex帮助文档(html格式)制作及ASDoc的使用

Flex Realspace产品在sp3时上线,急需制作帮助文档,由于在开发的时候没有考虑后期的帮助文档,查了很多资料,希望通过ASDoc达成愿望,感兴趣的朋友可以了解下,或许对你有所帮助
收藏 0 赞 0 分享
查看更多