本教程知识点:

Flex建立一AIR程序

窗口透明的AIR程序

打包成.AIR文件

第一步:打开FLEX3  创建一个 FLEX project

AIR 教程:生成100%透明窗口,以及打包成.air

 

接着是命名,并选中 Desktop application 在AIR中运行

AIR 教程:生成100%透明窗口,以及打包成.air

自动生产XML配置文件

创建好以后FLEX3会自动生产一些文件,再Src文件夹里会有两个XML描述语言:

.MXML文件为前台描述文件

.XML里面可以更改一些系统配置

本例:去除AIR窗口,并让AIR程序边界透明。

 我们打开airia_ex_login-app.xml这个文件

找到: <systemChrime></systemChrime> 和 <transparent></transparent>

AIR 教程:生成100%透明窗口,以及打包成.air

修改为下图蓝色区域。

<systemChrime>none</systemChrime>  表示没有系统窗口

<transparent>true</transparent>    表示开启背景透明

AIR 教程:生成100%透明窗口,以及打包成.air

注意:要去掉<!– –> 也就是说,本身默认文件是把这两项给注释掉了,我们现在把他启用。

注意2:本教程省略了案例中“AIR界面UI设计”的过程,UI界面源文件在附件内里有。

 

这样我们就完成了第一步。运行一下看看结果?

AIR 教程:生成100%透明窗口,以及打包成.air

我们发现FLEX有个默认的STYLE显示了出来。我们现在要想办法把他去掉

第二步:配置MXML文件中的“mx:WindowedApplication”

在 mx:WindowedApplication 内添加一下定制便可去掉FLEX默认的风格界面。

showFlexChrome="false"      

 alwaysInFront="true" 

 layout="absolute" 

这里我们再把界面大小设定好。

 

 width="314" 

 height="460"

如图:

AIR 教程:生成100%透明窗口,以及打包成.air

再次运行看看:

AIR 教程:生成100%透明窗口,以及打包成.air

GOOD!一个完美100%透明的AIR RUN起来了。

 

也许你还会碰到一下问题

窗口没办法在桌面拖动?

没办法关闭和最小化?

请关注AIRIA.cn原创教程的下一集

 

 

最后把此例的源文件、工程文件、安装.AIR文件全部提供给大家下载参考,忘各位网友支持AIRIA的发展。 

 

AIR 教程:生成100%透明窗口,以及打包成.air

 附件:

 

 

 

扩展参考: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 /> </mx:AddChild> </mx:State> </mx:states> </mx:Application> 

相关文章:

  • 2022-12-23
  • 2021-10-27
  • 2022-02-08
  • 2021-10-09
  • 2022-01-21
  • 2022-12-23
  • 2021-06-15
猜你喜欢
  • 2021-11-27
  • 2021-06-16
  • 2022-12-23
  • 2021-08-04
  • 2022-02-09
  • 2021-12-18
相关资源
相似解决方案