You might be able to set a timer for your CLICK. Eg: If this is clicked so fast, do CLICK else do MOUSE_UP

Karl

Sent from losPhone

On Jul 12, 2009, at 4:08 AM, "Allandt Bik-Elliott (Receptacle)" <[email protected] > wrote:

hi guys

quick question - is it possible to separate a MOUSE_UP event from a CLICK event?

i have a mouse listener function that does the following:

[code]
       private function grabListener(e:MouseEvent):void
       {
           switch(e.type)
           {
               case MouseEvent.MOUSE_DOWN :
                   startDrag();
stage.addEventListener(MouseEvent.MOUSE_UP, grabListener, false, 0, true); addEventListener(MouseEvent.MOUSE_MOVE, grabListener, false, 0, true);
                   break;

               case MouseEvent.MOUSE_UP :
                   stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, grabListener);
                   break;

               case MouseEvent.MOUSE_MOVE :
                   _nShowPosition = y;
                   break;

               case MouseEvent.CLICK :
                   popup();
                   break;
           }
       }
[/code]

but the problem is that every time MOUSE_UP fires, it also completes the CLICK event, even after the user has dragged the object

i've tried setting the useCapture to true for the following line
stage.addEventListener(MouseEvent.MOUSE_UP, grabListener, true, 0, true);
and in the mouse_up case i've tried doing the following
   e.stopPropagation() and e.stopImmediatePropagation()
to try and head the event off before it gets to the click but i guess because click is a separate event, it didn't affect it

am i missing a trick here?

hope you can help

best
alz

thefieldcomic.com

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to