flex 拖曳疑问 实在是没辙了

fudg1211 fudg1211 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
//先看代码
package component
{
import flash.events.MouseEvent;

public class Drag_move
{
public var obj:Object;
public var check:Boolean;
//import flash.display.Stage;
public function Drag_move(obj:Object,stage:Object)
{
this.obj=obj;
this.obj.addEventListener(MouseEvent.MOUSE_DOWN,this.move_start);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.move);//疑问1 为什么不能直接写stage
stage.addEventListener(MouseEvent.MOUSE_UP,this.move_stop);//疑问2 怎么写进第二个参数 比如stage
}
public function move_start(evt:MouseEvent):void{
this.check=true;
}
public function move(evt:MouseEvent):void{
if(this.check){
this.obj.x=evt.localX;
this.obj.y=evt.localY;
}
}
public function move_stop(evt:MouseEvent):void{
this.check=false;
}

}
}

小弟实在是没分 先谢谢各位大哥了
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
fudg1211
Flex 4,326 成员 9,103 内容