Language Version : | ActionScript 3.0 |
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);