Detect Mouse leave stage while dragging in Actionscript 3

后端 未结 8 600
我寻月下人不归
我寻月下人不归 2020-12-05 05:27

Event.MOUSE_LEAVE is great in Actionscript 3, but it doesn\'t seem to fire if the user is holding their left (or right for that matter) mouse button down.

Is there a

8条回答
  •  萌比男神i
    2020-12-05 06:29

        var youMax_X:Number; //set this var to Max x
        var youMax_Y:Number; //set this var to `enter code here`Max y
    
        var dragBounds:Rectangle = new Rectangle(0,0,youMax_X,yourMax_Y);
    
        stage.addEventListener(MouseEvent.MOUSE_DOWN,handleDown);
        stage.addEventListener(MouseEvent.MOUSE_UP,handleUp);
    
    
        private function handleDown(e:Event):void{
                this.startDrag(false,dragBounds);
        }
        private function handleUp(e:Event):void{
            this.stopDrag();
        }
    

提交回复
热议问题