





|
Syntax onEnterFrame() { statement(s); } onEnterFrame(includingFirstFrame) { statement(s); } onEnterFrame(excludingFirstFrame) { statement(s); } Arguments includingFirstFrame: Optional keyword. see below excludingFirstFrame: Optional keyword. See below. Returns Nothing. Description This Event Handler Function is called at the start of each frame of display, whether the associated object is playing or not. However, if the sprite is removed, then the onEnterFrame actions are no longer processed. The Actions associated with the Event are processed before any Frame Action events for the object. If "includingFirstFrame" is specified, then the actions will be processed on all frames of display starting from and including the very first frame that the object is placed. If "excludingFirstFrame" is specified, then it will not run for the first time until the frame AFTER the object is placed. Compare this with the onLoad Event Handler Function, which will run ONLY for the first frame of display. The default if you specify neither option is "excludingFirstFrame" (this is the same behaviour as Flash uses for its enterFrame clip event). This Event Handler is an ideal place to install collision detection routines for games, etc. Sample s1, s2 are both Sprites. Below is the scripting for Sprite s1. Debug trace is generated on transition. onEnterFrame() { blIsNear = _parent.s2.isNearThis(); if (blIsNear != blIsNearLast) { // we have moved to or from is Near condition trace("x=" + _X + " y=" + _Y + " isnear=" + blIsNear); } blIsNearLast = blIsNear; } onLoad () { blIsNearLast = false; // initialise boundary condition } onSelfEvent (press) { this.startDragLocked(); // when object is clicked on, start mouse drag } onSelfEvent (release) { stopDrag(); // when mouse is released, stop mouse drag } |


|
Self Events occur when the mouse interacts with an Object in a Scene or a defined key is pressed. Only Objects that are defined as Targets can use Self Events. More than one Self Event can trigger the same Action. · onSelfEvent (press): press the left mouse button while the cursor is over the Sprite · onSelfEvent (release): release the left mouse button while the cursor is over the Sprite · onSelfEvent (rollOver): move the mouse cursor from outside the Sprite to over it with no mouse button pressed · onSelfEvent (rollOut): move the mouse cursor from over the Sprite to outside it with no mouse button pressed · onSelfEvent (dragOver): move the mouse cursor from outside the Sprite to over it with the left mouse button pressed · onSelfEvent (dragOut): move the mouse cursor from over the Sprite to outside it with the left mouse button pressed · onSelfEvent (releaseOut): release the left mouse button after moving the cursor outside the Sprite · onSelfEvent (keyPress): press the define Key. The required key can be entered in the Key field or selected from the common keys drop-down Menu. |
