其实在这里的自定义皮肤,就是隐藏了边框..然后使用在程序里的元件..调用相关的命令,达到一般的窗体功能..
隐藏了边框在Flash中设置步骤为:(命令 > AIR - 应用程序与安装程序设置 > 窗体样式 - > 自定义镶边)
下面是文档类中的代码..代码比较简单.我就不多说明了..代码中有备注..
//Copyright © 2008. Http://L4cd.Net All Rights Reserved.
package{
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
import net.L4cd.iDoubleClick;
/**
* 自定义AIR皮肤,常用窗体操作说明
*
* @author L4cd.Net
* @playerversion Flash player 9
* @langversion 3.0
* @version 2008-9-15 23:02
*/
public class UI_Example extends Sprite{
public function UI_Example(){
init()
}
/**
* 初始化
*/
private function init():void{
stage.align = "TL";
stage.scaleMode = "noScale";
stage.addEventListener(Event.RESIZE,stage_resize);
bt_min.addEventListener(MouseEvent.CLICK,min);
bt_max.stop();
bt_max.addEventListener(MouseEvent.CLICK,max);
bt_close.addEventListener(MouseEvent.CLICK,close);
mc_title.addEventListener(MouseEvent.MOUSE_DOWN,drag);
iDoubleClick.enable(mc_title);//其中这里使用了自定义的双击事件..自带的事件经常误操作
mc_title.addEventListener(MouseEvent.DOUBLE_CLICK,max);
bt_resize.addEventListener(MouseEvent.MOUSE_DOWN,resize);
stage_resize(null);
}
/**
* 捕捉Event.RESIZE事件..调整控制大小位置
*/
private function stage_resize(e:Event):void{
bt_min.x = stage.stageWidth - 65
bt_max.x = stage.stageWidth - 45
bt_close.x = stage.stageWidth - 25
mc_title.width = stage.stageWidth;
mc_foot.width = stage.stageWidth - 26;
bt_resize.x = stage.stageWidth - 25;
mc_foot.y = bt_resize.y = stage.stageHeight - 22;
txt_input.width = stage.stageWidth - 4;
txt_input.height = stage.stageHeight - 76;
}
/**
* 调整大小
*/
private function resize(e:MouseEvent):void{
stage.nativeWindow.startResize()
}
/**
* 拖动
*/
private function drag(e:MouseEvent):void{
stage.nativeWindow.startMove()
}
/**
* 关闭
*/
private function close(e:MouseEvent):void{
stage.nativeWindow.close();
}
/**
* 最小化
*/
private function min(e:MouseEvent):void{
stage.nativeWindow.minimize();
}
/**
* 最大化/还原
*/
private function max(e:MouseEvent):void{
if(bt_max.currentFrame == 1){
bt_max.gotoAndStop(2)
stage.nativeWindow.maximize();
}else{
bt_max.gotoAndStop(1)
stage.nativeWindow.restore();
}
}
}
}
文章来自: 闪客居(www.flashas.net) 详文参考:http://www.flashas.net/html/air/20081005/3664.html