MouseEvents:
CLICK :Used to detect mouse clicks.
DOUBLE_CLICK: Used to detect double clicks.
MOUSE_DOWN :Checks when mouse is pressed down.
MOUSE_LEAVE : Monitors when the mouse leaves the stage.
MOUSE_MOVE :Monitors when the mouse moves.
MOUSE_OUT : Monitors when the mouse moves out of the attached to object of the event.
MOUSE_OVER : Monitors when the mouse moves over the attached to object of the event.
MOUSE_UP :Monitors when the mouse moves up the attached to object of the event from a click.
MOUSE_WHEEL : Monitors when the mouse wheel moves, detect the positive or negative delta property for distance and direction moved.
*********************************************************************
Example Usage:
import flash.events.MouseEvent;
example_mc.addEventListener(MouseEvent.CLICK, yourFunction);
function yourFunction(evt:MouseEvent){
// Things Happen Here
}
************************************************************
************************************************************
Events:
************************************************************
example_mc.addEventListener(MouseEvent.CLICK, yourFunction);
function yourFunction(evt:MouseEvent){
// Things Happen Here
}
************************************************************
************************************************************
Events:
ENTER_FRAME :Executes a function on EVERY FRAME at framerate.
import flash.events.Event;
stage.addEventListener(Event.ENTER_FRAME, yourFunction);
function yourFunction(evt:Event){
// Things Happen Here
}
*********************************************************************************************************************************
Example Usage:
stage.addEventListener(Event.ENTER_FRAME, yourFunction);
function yourFunction(evt:Event){
// Things Happen Here
}
************************************************************
KeyboardEvents:
************************************************************
KEY_DOWN :Executes a function when ANY keyboard key goes down.
KEY_UP :Executes a function when ANY keyboard comes up after being hit.
KEY_UP :Executes a function when ANY keyboard comes up after being hit.
*********************************************************************
Example Usage:
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);function onKeyPressed(evt:KeyboardEvent):void {
switch (evt.keyCode) // The "SWITCH CASE" statements
switch (evt.keyCode) // The "SWITCH CASE" statements
//are a form of "If Then"
{
case Keyboard.ENTER :
trace("Enter Key Hit!");
break;
case Keyboard.LEFT :
trace("Left Key Hit!");
break;
case Keyboard.RIGHT :
trace("Right Key Hit!");
break;
case Keyboard.UP :
trace("UP Key Hit!");
break;
case Keyboard.DOWN :
trace("DOWN Key Hit!");
break;
case 65:
trace("A has been hit!");
break;
default :
trace("keyCode:", evt.keyCode);
}
}
************************************************************{
case Keyboard.ENTER :
trace("Enter Key Hit!");
break;
case Keyboard.LEFT :
trace("Left Key Hit!");
break;
case Keyboard.RIGHT :
trace("Right Key Hit!");
break;
case Keyboard.UP :
trace("UP Key Hit!");
break;
case Keyboard.DOWN :
trace("DOWN Key Hit!");
break;
case 65:
trace("A has been hit!");
break;
default :
trace("keyCode:", evt.keyCode);
}
}
************************************************************
No comments:
Post a Comment