Package | mx.events |
Class | public dynamic class DynamicEvent |
Inheritance | DynamicEvent flash.events.Event |
By contrast, Event and its other subclasses are non-dynamic, meaning that you can only set properties that are declared in those classes. When prototyping an application, using a DynamicEvent can be easier because you don't have to write an Event subclass to declare the properties in advance. However, you should eventually eliminate your DynamicEvents and write Event subclasses because these are faster and safer. A DynamicEvent is so flexible that the compiler can't help you catch your error when you set the wrong property or assign it a value of an incorrect type.
Example:
var event:DynamicEvent = new DynamicEvent("credentialsChanged"); event.name = name; event.passsword = password; // misspelling won't be caught! dispatchEvent(event);
Method | Defined by | ||
---|---|---|---|
DynamicEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)
Constructor.
| DynamicEvent |
DynamicEvent | () | constructor |
public function DynamicEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)
Constructor.
Parameterstype:String — The event type; indicates the action that caused the event.
|
|
bubbles:Boolean (default = false ) — Specifies whether the event can bubble up
the display list hierarchy.
|
|
cancelable:Boolean (default = false ) — Specifies whether the behavior
associated with the event can be prevented.
|