| Package | starling.events |
| Class | public class Event |
| Inheritance | Event Object |
| Subclasses | DataGridEvent, DragDropEvent, DragDropTreeEvent, EnterFrameEvent, KeyboardEvent, ResizeEvent, TouchEvent, TreeEvent |
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 | ||
| data : Object [read-only] Arbitrary data that is attached to the event. | 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, data:Object = null) 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 | ||
| CANCEL : String = cancel [static] An event type to be utilized in custom events. | Event | ||
| CHANGE : String = change [static] An event type to be utilized in custom events. | Event | ||
| CLOSE : String = close [static] An event type to be utilized in custom events. | Event | ||
| COMPLETE : String = complete [static] Event type that may be used whenever something finishes. | Event | ||
| CONTEXT3D_CREATE : String = context3DCreate [static] Event type for a (re)created stage3D rendering context. | Event | ||
| ENTER_FRAME : String = enterFrame [static] Event type for a display object that is entering a new frame. | Event | ||
| FATAL_ERROR : String = fatalError [static] Event type that is dispatched by the Starling instance when it encounters a problem
from which it cannot recover, e.g. | Event | ||
| IO_ERROR : String = ioError [static] Event type that is dispatched by the AssetManager when a file/url cannot be loaded. | Event | ||
| OPEN : String = open [static] An event type to be utilized in custom events. | Event | ||
| PARSE_ERROR : String = parseError [static] Event type that is dispatched by the AssetManager when an xml or json file couldn't
be parsed. | Event | ||
| READY : String = ready [static] An event type to be utilized in custom events. | 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 | ||
| REMOVE_FROM_JUGGLER : String = removeFromJuggler [static] Event type for an animated object that requests to be removed from the juggler. | Event | ||
| RENDER : String = render [static] Event type that is dispatched by the Starling instance directly before rendering. | Event | ||
| RESIZE : String = resize [static] Event type for a resized Flash Player. | Event | ||
| ROOT_CREATED : String = rootCreated [static] Event type that indicates that the root DisplayObject has been created. | Event | ||
| SCROLL : String = scroll [static] An event type to be utilized in custom events. | Event | ||
| SECURITY_ERROR : String = securityError [static] Event type that is dispatched by the AssetManager when a file/url cannot be loaded. | Event | ||
| SELECT : String = select [static] An event type to be utilized in custom events. | Event | ||
| TEXTURES_RESTORED : String = texturesRestored [static] Event type that is dispatched by the AssetManager after a context loss. | Event | ||
| TRIGGERED : String = triggered [static] Event type for a triggered button. | Event | ||
| UPDATE : String = update [static] An event type to be utilized in custom events. | 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| data | property |
data:Object [read-only] Arbitrary data that is attached to the event.
public function get data():Object| 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, data:Object = null)Creates an event object that can be passed to listeners.
Parameterstype:String | |
bubbles:Boolean (default = false) | |
data:Object (default = null) |
| 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
| CANCEL | Constant |
public static const CANCEL:String = cancelAn event type to be utilized in custom events. Not used by Starling right now.
| CHANGE | Constant |
public static const CHANGE:String = changeAn event type to be utilized in custom events. Not used by Starling right now.
| CLOSE | Constant |
public static const CLOSE:String = closeAn event type to be utilized in custom events. Not used by Starling right now.
| COMPLETE | Constant |
public static const COMPLETE:String = completeEvent type that may be used whenever something finishes.
| CONTEXT3D_CREATE | Constant |
public static const CONTEXT3D_CREATE:String = context3DCreateEvent type for a (re)created stage3D rendering context.
| ENTER_FRAME | Constant |
public static const ENTER_FRAME:String = enterFrameEvent type for a display object that is entering a new frame.
| FATAL_ERROR | Constant |
public static const FATAL_ERROR:String = fatalErrorEvent type that is dispatched by the Starling instance when it encounters a problem from which it cannot recover, e.g. a lost device context.
| IO_ERROR | Constant |
public static const IO_ERROR:String = ioErrorEvent type that is dispatched by the AssetManager when a file/url cannot be loaded.
| OPEN | Constant |
public static const OPEN:String = openAn event type to be utilized in custom events. Not used by Starling right now.
| PARSE_ERROR | Constant |
public static const PARSE_ERROR:String = parseErrorEvent type that is dispatched by the AssetManager when an xml or json file couldn't be parsed.
| READY | Constant |
public static const READY:String = readyAn event type to be utilized in custom events. Not used by Starling right now.
| REMOVE_FROM_JUGGLER | Constant |
public static const REMOVE_FROM_JUGGLER:String = removeFromJugglerEvent type for an animated object that requests to be removed from the juggler.
| 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.
| RENDER | Constant |
public static const RENDER:String = renderEvent type that is dispatched by the Starling instance directly before rendering.
| RESIZE | Constant |
public static const RESIZE:String = resizeEvent type for a resized Flash Player.
| ROOT_CREATED | Constant |
public static const ROOT_CREATED:String = rootCreatedEvent type that indicates that the root DisplayObject has been created.
| SCROLL | Constant |
public static const SCROLL:String = scrollAn event type to be utilized in custom events. Not used by Starling right now.
| SECURITY_ERROR | Constant |
public static const SECURITY_ERROR:String = securityErrorEvent type that is dispatched by the AssetManager when a file/url cannot be loaded.
| SELECT | Constant |
public static const SELECT:String = selectAn event type to be utilized in custom events. Not used by Starling right now.
| TEXTURES_RESTORED | Constant |
public static const TEXTURES_RESTORED:String = texturesRestoredEvent type that is dispatched by the AssetManager after a context loss.
| TRIGGERED | Constant |
public static const TRIGGERED:String = triggeredEvent type for a triggered button.
| UPDATE | Constant |
public static const UPDATE:String = updateAn event type to be utilized in custom events. Not used by Starling right now.