This has to be an easy AS3 question…doesn’t it?
I am not seeing the below code 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.CLICK, function(event:MouseEvent)
{
// event.preventDefault();
trace("Mouse CLICK");
} );
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");
_mouse = "click";
} );
_sprite.addEventListener(MouseEvent.MOUSE_DOWN, function(event:Event)
{
// event.preventDefault();
trace("Mouse down");
_mouse = "down";
} );
_sprite.addEventListener(MouseEvent.MOUSE_UP, function(event:Event)
{
event.preventDefault();
trace("Mouse up");
_mouse = "up";
} );