flex 拖曳疑问 实在是没辙了
//先看代码
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;
}
}
}
小弟实在是没分 先谢谢各位大哥了