用Flex建立一个100%窗口透明的AIR程序,以及打包成.AIR文件
2008-11-28 22:19
399 查看
第一步:打开FLEX3 创建一个 FLEX project
接着是命名,并选中 Desktop application 在AIR中运行
自动生产XML配置文件
创建好以后FLEX3会自动生产一些文件,再Src文件夹里会有两个XML描述语言:
.MXML文件为前台描述文件
.XML里面可以更改一些系统配置
本例:去除AIR窗口,并让AIR程序边界透明。
我们打开airia_ex_login-app.xml这个文件
找到: <systemChrime></systemChrime> 和 <transparent></transparent>
修改为下图蓝色区域。
<systemChrime>none</systemChrime> 表示没有系统窗口
<transparent>true</transparent> 表示开启背景透明
注意:要去掉<!-- --> 也就是说,本身默认文件是把这两项给注释掉了,我们现在把他启用。
注意2:本教程省略了案例中“AIR界面UI设计”的过程,UI界面源文件在附件内里有。
这样我们就完成了第一步。运行一下看看结果?
我们发现FLEX有个默认的STYLE显示了出来。我们现在要想办法把他去掉
第二步:配置MXML文件中的“mx:WindowedApplication”
在 mx:WindowedApplication 内添加一下定制便可去掉FLEX默认的风格界面。
showFlexChrome="false"
alwaysInFront="true"
layout="absolute"
这里我们再把界面大小设定好。
width="314"
height="460"
GOOD!一个完美100%透明的AIR RUN起来了。
也许你还会碰到一下问题
窗口没办法在桌面拖动?
没办法关闭和最小化?
请关注AIRIA.cn原创教程的下一集
最后把此例的源文件、工程文件、安装.AIR文件全部提供给大家下载参考,忘各位网友支持AIRIA的发展。
附件:
扩展参考:flex制作一个用户登录框(含验证码)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
fontSize="12" horizontalAlign="center" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function init():void{
generate.text=generateCheckCode();
}
//login identifying
private function loginHandler():void{
if(user.text==""||pass.text==""){
Alert.show("user or pass is empty","tips");
}else{
if(user.text=="shane"&&pass.text=="shane"
&&identify.text.toLowerCase()==generate.text.toLowerCase()){
Alert.show("login is OK","tips");
currentState="hollow";
}else{
if(identify.text.toLowerCase()!=generate.text.toLowerCase()){
Alert.show("indentifyCode is error","tips");
generate.text=generateCheckCode();
}else{
Alert.show("user or pass error","tips");
}
}
}
}
//clear
private function clearHandler():void{
user.text=pass.text="";
}
//generate identifying coder
private function generateCheckCode():String{
//init
var num:Number;
var code:String;
var checkCode:String="";
for(var i:int=0;i<5;i++){
num=Math.round(Math.random()*100000);
if(num%2==0){
code=String.fromCharCode(48+(num%10));
}else{
code=String.fromCharCode(65+(num%26));
}
checkCode +=code;
}
return checkCode;
}
]]>
</mx:Script>
<mx:Panel id="panel" x="143" y="115" width="350" height="229" layout="absolute" title="login">
<mx:Button id="btnLogin" x="73" y="141" label="login" click="loginHandler()"/>
<mx:Button id="btnClear" x="167" y="141" label="clear" click="clearHandler()"/>
<mx:Label x="44" y="31" text="user"/>
<mx:Label x="44" y="64" text="pass"/>
<mx:TextInput id="user" x="81" y="31"/>
<mx:TextInput id="pass" x="81" y="62" displayAsPassword="true"/>
<mx:Text x="28" y="100" text="identify"/>
<mx:TextInput x="81" y="98" width="50" id="identify"/>
<mx:Label x="139" y="100" width="48" id="generate"/>
<mx:Label x="195" y="100" text="看不清楚 换个~~" click="generateCheckCode()"/>
</mx:Panel>
<mx:states>
<mx:State name="hollow">
<mx:RemoveChild target="{panel}"/>
<mx:AddChild position="lastChild">
<mx:Label text="hollow marshane" x="0" y="200" fontSize="200" color="red"/>
</mx:AddChild>
</mx:State>
</mx:states>
</mx:Application>
接着是命名,并选中 Desktop application 在AIR中运行
自动生产XML配置文件
创建好以后FLEX3会自动生产一些文件,再Src文件夹里会有两个XML描述语言:
.MXML文件为前台描述文件
.XML里面可以更改一些系统配置
本例:去除AIR窗口,并让AIR程序边界透明。
我们打开airia_ex_login-app.xml这个文件
找到: <systemChrime></systemChrime> 和 <transparent></transparent>
修改为下图蓝色区域。
<systemChrime>none</systemChrime> 表示没有系统窗口
<transparent>true</transparent> 表示开启背景透明
注意:要去掉<!-- --> 也就是说,本身默认文件是把这两项给注释掉了,我们现在把他启用。
注意2:本教程省略了案例中“AIR界面UI设计”的过程,UI界面源文件在附件内里有。
这样我们就完成了第一步。运行一下看看结果?
我们发现FLEX有个默认的STYLE显示了出来。我们现在要想办法把他去掉
第二步:配置MXML文件中的“mx:WindowedApplication”
在 mx:WindowedApplication 内添加一下定制便可去掉FLEX默认的风格界面。
showFlexChrome="false"
alwaysInFront="true"
layout="absolute"
这里我们再把界面大小设定好。
width="314"
height="460"
GOOD!一个完美100%透明的AIR RUN起来了。
也许你还会碰到一下问题
窗口没办法在桌面拖动?
没办法关闭和最小化?
请关注AIRIA.cn原创教程的下一集
最后把此例的源文件、工程文件、安装.AIR文件全部提供给大家下载参考,忘各位网友支持AIRIA的发展。
附件:
扩展参考:flex制作一个用户登录框(含验证码)
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
fontSize="12" horizontalAlign="center" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function init():void{
generate.text=generateCheckCode();
}
//login identifying
private function loginHandler():void{
if(user.text==""||pass.text==""){
Alert.show("user or pass is empty","tips");
}else{
if(user.text=="shane"&&pass.text=="shane"
&&identify.text.toLowerCase()==generate.text.toLowerCase()){
Alert.show("login is OK","tips");
currentState="hollow";
}else{
if(identify.text.toLowerCase()!=generate.text.toLowerCase()){
Alert.show("indentifyCode is error","tips");
generate.text=generateCheckCode();
}else{
Alert.show("user or pass error","tips");
}
}
}
}
//clear
private function clearHandler():void{
user.text=pass.text="";
}
//generate identifying coder
private function generateCheckCode():String{
//init
var num:Number;
var code:String;
var checkCode:String="";
for(var i:int=0;i<5;i++){
num=Math.round(Math.random()*100000);
if(num%2==0){
code=String.fromCharCode(48+(num%10));
}else{
code=String.fromCharCode(65+(num%26));
}
checkCode +=code;
}
return checkCode;
}
]]>
</mx:Script>
<mx:Panel id="panel" x="143" y="115" width="350" height="229" layout="absolute" title="login">
<mx:Button id="btnLogin" x="73" y="141" label="login" click="loginHandler()"/>
<mx:Button id="btnClear" x="167" y="141" label="clear" click="clearHandler()"/>
<mx:Label x="44" y="31" text="user"/>
<mx:Label x="44" y="64" text="pass"/>
<mx:TextInput id="user" x="81" y="31"/>
<mx:TextInput id="pass" x="81" y="62" displayAsPassword="true"/>
<mx:Text x="28" y="100" text="identify"/>
<mx:TextInput x="81" y="98" width="50" id="identify"/>
<mx:Label x="139" y="100" width="48" id="generate"/>
<mx:Label x="195" y="100" text="看不清楚 换个~~" click="generateCheckCode()"/>
</mx:Panel>
<mx:states>
<mx:State name="hollow">
<mx:RemoveChild target="{panel}"/>
<mx:AddChild position="lastChild">
<mx:Label text="hollow marshane" x="0" y="200" fontSize="200" color="red"/>
</mx:AddChild>
</mx:State>
</mx:states>
</mx:Application>
相关文章推荐
- 用Flex建立一个100%窗口透明的AIR程序
- AIR 教程:生成100%透明窗口,以及打包成.air
- AIR 教程:生成100%透明窗口,以及打包成.air
- [FLEX]AIR程序外观透明效果教程
- 使用autoconfig/automake生成makefile文件以及将程序打包为tar.gz
- NanoPi—M1(H3)———HAL程序编译、打包进安卓系统镜像以及so文件存放位置
- Delphi编程获取系统当前进程、窗口句柄、文件属性以及程序运行状态(8种应用)
- WEB程序打包详解:(连接SQL2005数据库,修改配置文件,建立虚拟目录)
- WEB程序打包详解:(连接SQL2005数据库,修改配置文件,建立虚拟目录)
- 程序缘 Flex AIR之旅--第五章 搭建主工程文件
- Flex开发背景透明的AIR程序
- Flex AIR 程序与运行环境打包
- eclipse通过maven建立java se工程配置log4j,打包成zip,将jar包和配置文件分开,并以bat和sh文件启动java程序
- (Java控制台程序版)递归打包整个父文件夹下的文件和子文件夹成压缩文件(*.ZIP)以及打包时常见的文件乱码和文件名乱码以及丢失文件或文件损坏问题解决办法
- 制作一个Flex AIR 程序调用 可执行程序(mxmlc.exe) 并且 生成.as文件并编译为.swf文件
- Flex4 AIR程序去除窗口边框, 最大化
- (转)WEB程序打包详解:(连接SQL2005数据库,修改配置文件,建立虚拟目录)
- VC菜菜鸟:建立第一个基于Visual C++的Windows窗口程序
- 把Java程序打包成jar文件包并执行
- 将java程序打包成exe可执行文件