| Package | starling.events |
| Class | public class Event |
| Inheritance | Event Object |
| Subclasses | EnterFrameEvent, KeyboardEvent, ResizeEvent, TouchEvent |
EventDispatchers create instances of this class and send them to registered listeners. An event object contains information that characterizes an event, most importantly the event type and if the event bubbles. The target of an event is the object that dispatched it.
For some event types, this information is sufficient; other events may need additional information to be carried to the listener. In that case, you can subclass "Event" and add properties with all the information you require. The "EnterFrameEvent" is an example for this practice; it adds a property about the time that has passed since the last frame.
Furthermore, the event class contains methods that can stop the event from being processed by other listeners - either completely or at the next bubble stage.
See also
| Property | Defined By | ||
|---|---|---|---|
| bubbles : Boolean [read-only] Indicates if event will bubble. | Event | ||
| currentTarget : EventDispatcher [read-only] The object the event is currently bubbling at. | Event | ||
| target : EventDispatcher [read-only] The object that dispatched the event. | Event | ||
| type : String [read-only] A string that identifies the event. | Event | ||
| Method | Defined By | ||
|---|---|---|---|
Event(type:String, bubbles:Boolean = false) Creates an event object that can be passed to listeners. | Event | ||
stopImmediatePropagation():void Prevents any other listeners from receiving the event. | Event | ||
stopPropagation():void Prevents listeners at the next bubble stage from receiving the event. | Event | ||
toString():String Returns a description of the event, containing type and bubble information. | Event | ||
| Constant | Defined By | ||
|---|---|---|---|
| ADDED : String = added [static] Event type for a display object that is added to a parent. | Event | ||
| ADDED_TO_STAGE : String = addedToStage [static] Event type for a display object that is added to the stage | Event | ||
| ENTER_FRAME : String = enterFrame [static] Event type for a display object that is entering a new frame. | Event | ||
| FLATTEN : String = flatten [static] Event type for a display object that is being flattened. | Event | ||
| MOVIE_COMPLETED : String = movieCompleted [static] Event type for a movie that has reached the last frame. | Event | ||
| REMOVED : String = removed [static] Event type for a display object that is removed from its parent. | Event | ||
| REMOVED_FROM_STAGE : String = removedFromStage [static] Event type for a display object that is removed from the stage. | Event | ||
| RESIZE : String = resize [static] Event type for a resized Flash Player. | Event | ||
| TRIGGERED : String = triggered [static] Event type for a triggered button. | Event | ||
| bubbles | property |
bubbles:Boolean [read-only] Indicates if event will bubble.
public function get bubbles():Boolean| currentTarget | property |
currentTarget:EventDispatcher [read-only] The object the event is currently bubbling at.
public function get currentTarget():EventDispatcher| target | property |
target:EventDispatcher [read-only] The object that dispatched the event.
public function get target():EventDispatcher| type | property |
type:String [read-only] A string that identifies the event.
public function get type():String| Event | () | Constructor |
public function Event(type:String, bubbles:Boolean = false)Creates an event object that can be passed to listeners.
Parameterstype:String | |
bubbles:Boolean (default = false) |
| stopImmediatePropagation | () | method |
public function stopImmediatePropagation():voidPrevents any other listeners from receiving the event.
| stopPropagation | () | method |
public function stopPropagation():voidPrevents listeners at the next bubble stage from receiving the event.
| toString | () | method |
public function toString():StringReturns a description of the event, containing type and bubble information.
ReturnsString |
| ADDED | Constant |
public static const ADDED:String = addedEvent type for a display object that is added to a parent.
| ADDED_TO_STAGE | Constant |
public static const ADDED_TO_STAGE:String = addedToStageEvent type for a display object that is added to the stage
| ENTER_FRAME | Constant |
public static const ENTER_FRAME:String = enterFrameEvent type for a display object that is entering a new frame.
| FLATTEN | Constant |
public static const FLATTEN:String = flattenEvent type for a display object that is being flattened.
| MOVIE_COMPLETED | Constant |
public static const MOVIE_COMPLETED:String = movieCompletedEvent type for a movie that has reached the last frame.
| REMOVED | Constant |
public static const REMOVED:String = removedEvent type for a display object that is removed from its parent.
| REMOVED_FROM_STAGE | Constant |
public static const REMOVED_FROM_STAGE:String = removedFromStageEvent type for a display object that is removed from the stage.
| RESIZE | Constant |
public static const RESIZE:String = resizeEvent type for a resized Flash Player.
| TRIGGERED | Constant |
public static const TRIGGERED:String = triggeredEvent type for a triggered button.