Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
DynamicEvent

Package | mx.events
Class | public dynamic class DynamicEvent
Inheritance | DynamicEvent flash.events.Event

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

This subclass of Event is dynamic, meaning that you can set arbitrary event properties on its instances at runtime.

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);

Public Methods

| Method | Defined By
--- | --- | ---
|  | DynamicEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) Constructor. | DynamicEvent

Constructor Detail

DynamicEvent | () | Constructor

`public function DynamicEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false)`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Constructor.

Parameters

| `type: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.

Wed Nov 15 2017, 09:50 AM +01:00