宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3.0的对象深度处理代码示例

2016-10-13 00:16:48 点击量:9 标签: 收藏本文

[AS3]as3.0的对象深度处理代码示例

  1. for (var i:int=1; i<=3; i++) {  
  2.  AddListener(this.getChildByName("m"+i));  
  3. }  
  4. function AddListener(mc:*):void {  
  5.  mc.addEventListener(MouseEvent.MOUSE_OVER,ChangeScale);  
  6.  mc.addEventListener(MouseEvent.MOUSE_OUT,ChangeScale);  
  7. }  
  8. function ChangeScale(e:MouseEvent):void {  
  9.  if (e.type=="mouseOver") {  
  10. this.setChildIndex(e.target as DisplayObject,this.numChildren-1)  
  11. //setChildIn改变对象在容器中的深度 极酷播放器提示:方法一  
  12. this.swapChildren(e.target as DisplayObject,getChildAt(this.numChildren-1));  
  13. //swapChildren交换目标mc深度;

    //numChildren容器内包含对象数量,不包含孙项;极酷播放器提示:方法二  
  14.   trace(getChildAt(2)==m1);  
  15. //getChildAt,获取目标深度上的对象;getChildByName根据对象名称获取深度  
  16.   e.target.scaleX=2;  
  17.   e.target.scaleY=2;  
  18.  } else {  
  19.   this.swapChildren(e.target as DisplayObject,getChildAt(this.numChildren-1));  
  20.   e.target.scaleX=1;  
  21.   e.target.scaleY=1;  
  22.  }  

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室