Skip to content

Adobe Flash

Matheus Dias de Souza edited this page Jun 14, 2024 · 1 revision

ActionScript 3, together with Apache Flex-specific languages, MXML and CSS3, is commonly used in the AIR runtime for developing interactive applications.

ActionScript 3 was always focused in Adobe technologies such as Adobe Flex (now "Apache" Flex, succeeded by Apache Royale) and certain features are not properly specified in the language, such as meta-data and ASDoc. The HARMAN company is gradually documenting everything except all of Flex. Full Flex documentation is in the "Using Adobe FLEX 4.6" PDF and the Apache Flex and Royale websites.

Events

AIR applications are built around class inheritance and dynamic dispatches.

The Event meta-data is crucial for Flex components, as they allow to handle events in MXML files.

AS3:

package foo.bar {
    import mx.core.*;

    /**
     * Optional ASDoc comment.
     * @eventType foo.bar.BarEvent.QUX
     */
    [Event(name="qux", type="foo.bar.BarEvent")]
    /**
     * Optional ASDoc comment.
     */
    public class Bar extends UIComponent {
    }
}

Somewhere in a MXML file:

<fb:Bar xmlns:fb="foo.bar.*" qux="trace('Qux')"></fb:Bar>

Event types (the type property of the Event object or subtype) take the convention of using static constants such as XEvent.EVENT_CONSTANT = "eventConstant", rather than directly using a string literal, as opposed to the type inference model in TypeScript.

Data binding

The [Bindable] meta-data is used either at a class definition, at a setter definition, or at a variable definition, to auto dispatch a PropertyChangeEvent event after direct assignment to specific properties.

It takes the forms:

[Bindable]
[Bindable("eventName")]
[Bindable(event="eventName")]

When applied to class, all variables or virtual slots are marked with a Bindable semantic using the event name propertyChange.

When applied to a setter definition or variable definition, the slot is marked with a Bindable semantic using either the default event name propertyChange or the specified event name.

Clone this wiki locally