mercredi 22 juin 2016

MOUSE_DOWN not firing when expected - AS3, Actionscript

MOUSE_DOWN not firing when expected - AS3, Actionscript

I am not seeing the below code trace in MOUSE_DOWN fired, until I lift the mouse button back up.

This happens even on a new FLA, with only MOUSE_DOWN, MOUSE_UP and CLICK handler code -- nothing else.

Regardless of what I do, I only see MOUSE_DOWN, MOUSE_UP and CLICK traced out AFTER I lift (release) the mouse button.. See code below.

It happens if I attach the handlers to the stage; or to a sprite.

It happens with/without buttonMode being set.

It happens with/without preventDefault() being called in CLICK..

It happens using event:MouseEvewnt or event:Event as some have suggested.

When I click, I see nothing. When I release, I see this: Mouse down Mouse up Mouse CLICK

Why don't I see "Mouse down" when clicking (before releasing)?

What the heck am I missing here?

Thank you!

stage.addEventListener(MouseEvent.MOUSE_DOWN, function(event:MouseEvent)
             {
                // event.preventDefault();  
                 trace("Mouse down");   
             } );

 stage.addEventListener(MouseEvent.MOUSE_UP, function(event:MouseEvent)
            {
                // event.preventDefault();
                trace("Mouse up");
            } );

 stage.addEventListener(MouseEvent.CLICK, function(event:Event)
        {
            // event.preventDefault();
            trace("Mouse CLICK");

        } );

Aucun commentaire:

Enregistrer un commentaire