0

I tried to fix a bug, for the last hour and I just couldnt.

The bug is:

If you press left click and dont release it, and then press right click (contextual menu appears) and then left click again, the first "drag" action is never released.

Its like, I need to make that my right click says: "hey left click, your job is done, you can go home now".

But I couldnt find a way.

Mattias
  • 3,907
  • 4
  • 28
  • 50
Artemix
  • 8,497
  • 14
  • 48
  • 75

1 Answers1

3

My solution is to listen to stage's mouse move and check MouseEvent.buttonDown. If it's false, stop drag:

protected function stageMouseMoveHandler(event:MouseEvent):void
{
    if (!event.buttonDown)
    {
        myComponent.stopDrag();
    }
}

It's important to listen to stage, not to your component, as soon as after context menu hides, the pointer can appear outside component and listeners won't execute.

moropus
  • 3,672
  • 1
  • 22
  • 30