0

我有 Sprite 对象,它是一个扑克筹码。当用户点击它时,出价会增加。我正在提高对MouseUp活动的出价。但是,如果用户在对象/芯片之外开始单击,然后将鼠标拖到芯片上并执行此操作MouseUp,它会触发映射到的函数MouseUp。如果单击从对象外部开始,如何防止它触发。

this.addEventListener(MouseEvent.MOUSE_DOWN, pressChipDown)
this.addEventListener(MouseEvent.MOUSE_UP, pressChipUp)
this.addEventListener(MouseEvent.MOUSE_OUT, pressChipOut)



private function pressChipDown(e:MouseEvent):void
    {
        super.x = startX + 5;
        super.y = startY + 5;
    }

    private function pressChipUp(e:MouseEvent):void
    {
        increaseBid();
        super.x = startX;
        super.y = startY;
    }

    private function pressChipOut(e:MouseEvent):void
    {
        if(e.buttonDown) //if mouse button is down, move chip back but dont increase bid
        {
            pressChipUp(MouseEvent.MOUSE_OUT as MouseEvent)
        }
    }

谢谢

4

1 回答 1

1

翻滚时,开始听鼠标向下和鼠标向上,如果在向下之前先向上,那就是“假”

this.addeventlistener(MouseEvent.ROLL_OVER, onOver)

...

于 2012-08-03T05:58:46.107 回答