What is the diffrence in MouseEvent.CLICK & MouseEvent.MOUSE_DOWN on ActionScript 3.0
I'd like to kno开发者_如何学Pythonw what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN
.
Because when i use MouseEvent.MOUSE_DOWN
for a button to set full-screen
view its doesn't work, instead of this MouseEvent.CLICK
works. So what was the reason.
I don't specifically know about ActionScript, but in general a mouse click
event consists of a mouse down
event, followed by a mouse up
.
MouseEvent.MOUSE_DOWN is dispatched when a user presses the mouse down but a MouseEvent.CLICK occurs when MouseEvent.MOUSE_DOWN is dispatched followed by a MouseEvent.MOUSE_UP event.
This is an important concept to consider when listening to events, in general I mostly use MouseEvent.CLICK on buttons as it is the logical interaction I would like to listen for. I want to make sure that button was both pressed and released.
And to answer why you cannot initilize full-screen mode:
"The ActionScript that initiates full-screen mode can be called only in response to a mouse click or keypress. If it is called in other situations, it will be ignored (in ActionScript 2.0) or throw an exception (in ActionScript 3.0)."
For more information you can read this: Exploring full-screen mode in Flash Player 9
In ActionScript 3.0 the difference between MouseEvent.MOUSE_DOWN
an MouseEvent.CLICK
is as Matt Ball says, that the CLICK
event is the act of down the mouse button into an object, and release it in the SAME object.
If you down the button in an object and then release it in other object you will have the next events triggered (in order):
Object 1
MouseEvent.MOUSE_DOWN
MouseEvent.ROLL_OUT // and MouseEvent.MOUSE_OUT
Object 2
MouseEvent.ROLL_IN // and MouseEvent.MOUSE_IN
MouseEvent.MOUSE_UP
But, if you press the button and release it in the same object you will have the next events triggered (in order):
Object 1 (the only one)
MouseEvent.MOUSE_DOWN
MouseEvent.MOUSE_UP
MouseEvent.CLICK
精彩评论