Coding the ActionScript side

A native extension is made of two parts:

  • ActionScript extension classes you define.

  • A native implementation.

The ActionScript extension classes access and exchange data with the native implementation. This access is provided with the ActionScript class ExtensionContext. Only ActionScript code that is part of an extension can access the ExtensionContext class methods.

Coding the ActionScript side of your extension includes the following tasks:

  • Declaring the public interfaces of your ActionScript extension class.

  • Using the static method ExtensionContext.createExtensionContext() to create an ExtensionContext instance.

  • Using the call() method of the ExtensionContext instance to call methods in the native implementation.

  • Adding event listeners to the ExtensionContext instance to listen for events dispatched from the native implementation.

  • Using the dispose() method to delete the ExtensionContext instance.

  • Sharing data between the ActionScript side and the native side. The data shared can be any ActionScript object.

  • Using the getExtensionDirectory() method to access the directory in which the extension is installed. All information and resources related to the extension are in this directory. (An exception to this rule exists for iOS devices.)

For examples of native extensions, see Native extensions for Adobe AIR .

For more information about the ExtensionContext class, see the ActionScript 3.0 Reference for the Adobe Flash Platform .

// Ethnio survey code removed