Self Events
Top  Previous  Next


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, as shown in the example below.

The Actions in a Self Event Handler apply to the Object itself. For example, with Sprites if a Self Event handler contains a stop() Action, then that Action stops the Sprite itself, not the main Movie. If you want the Actions to apply to the Movie, then use a Button Event instead.

You can insert a Self Event either by going to the Script Panel, selecting an Object, and pressing Add Script.

When you select a Self Event for an Object, the Self Event Properties are shown adjacent to the 'Event/Action' tree in the Script Panel.

selfevents-properties  

This contains a list of check boxes showing the Self Events. You can select a combination of Self Events, such as Roll Over and Roll Out, so that the same list of Actions can be performed for different Events. The Events and their triggers are described below:

·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.  

Note: Due to limitations of the Flash Player, the Play Sound and Stop Sound Action cannot be triggered by Drag Over, Drag Out or Release Outside Events

In the example below, both Press and Roll Over Actions will send the Movie to Frame one.

selfevents-example