2016-10-13 00:16:48 点击量:14 标签: 收藏本文
有n个mc,如何实现拖动一个mc时,让这个mc的层级是最上面的。mc是摆放在场景中的,不是new出来的。
- mc.addEventListener(MouseEvent.CLICK, clHandler);
- function clHandler(e:MouseEvent):void{
- setChildIndex(e.currentTarget,numChildren-1);
- }
这样写也可以
- setChildIndex(mcToolTiptop,numChildren-1);
另一种写法:
- swapChildren(mcToolTiptop,_videoScreen);
- var num:int = 2;
- for (var i:int = 0; i<num; i++){
- this["aa"+i].addEventListener(MouseEvent.MOUSE_DOWN,doDrag);
- this["aa"+i].addEventListener(MouseEvent.MOUSE_UP,stopDarg);
- }
- function doDrag(e:MouseEvent):void {
- var aa:MovieClip = e.target as MovieClip;
- aa.startDrag();
- setChildIndex(aa,numChildren-1);
- }
- function stopDarg(e:MouseEvent):void {
- var aa:MovieClip = e.target as MovieClip;
- aa.stopDrag();
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室