AIR自定义皮肤时常用到的操作

 

其实在这里的自定义皮肤,就是隐藏了边框..然后使用在程序里的元件..调用相关的命令,达到一般的窗体功能..
隐藏了边框在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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值