Canvas组件加监听:
this.addEventListener(MouseEvent.MOUSE_UP,MouseEventFunc); this.addEventListener(MouseEvent.MOUSE_DOWN,MouseEventFunc);
public function MouseEventFunc(evt:MouseEvent):void
{
switch (evt.type)
{
case "mouseDown" :
downXY=new Point(mouseX,mouseY);
evt.currentTarget.startDrag();
break;
case "mouseUp" :
upXY=new Point(mouseX,mouseY);
evt.currentTarget.stopDrag();
break;
default:
break;
}
}