AIR profile support: This feature is supported
only on AIR for TV devices in applications that use the
An ActionScript extension is a combination of:
You can create an ActionScript extension to give an AIR application access
to device-specific features. Other reasons to create an ActionScript extension are to
reuse existing native code, or to provide more efficient processing using native code than
you can provide with ActionScript code. For more information about writing, building, and
packaging ActionScript extensions, see the PDF
Use the ExtensionContext class in the ActionScript side of an ActionScript extension to access
the native side of the extension. First, create an instance of the ExtensionContext class.
To do so, call the static method
After creating the ExtensionContext instance, use the instance's
When you are done with an ExtensionContext instance, call
An ExtensionContext instance can listen for StatusEvent events that the native code dispatches when some asynchronous event occurs in the extension's native implementation. Since the ExtensionContext class derives from EventDispatcher, it can in turn dispatch events.
The ExtensionContext class also provides a static method
Note: AIR applications using the
The runtime notifies the native implementation, which can release any associated
native resources. After calling
Sometimes an extension includes resources such as images that you want to access from the extension's ActionScript code. Sometimes the code also requires information that is available in the extension descriptor file, such as the extension version number. You can use this method to access the base directory of the extension.
Regardless where the extension is located on the device, the extension's files are always in the same location relative to this base directory of the extension. Using the File instance that this method returns, you can navigate to and manipulate specific files included with the extension.
You can associate any ActionScript object with an ExtensionContext instance.
The native implementation can also get and set this ActionScript object. Therefore,
you can use
You can also set the value of
Using the ExternalInterface class, you can call an ActionScript function in the Flash runtime, using JavaScript in the HTML page. The ActionScript function can return a value, and JavaScript receives it immediately as the return value of the call.
This functionality replaces the
Use the ExternalInterface class in the following combinations of browser and operating system:
Flash Player for Linux version 9.0.31.0 and later supports the ExternalInterface class in the following browsers:
The ExternalInterface class requires the user's web browser to support either
ActiveX® or the NPRuntime API that is exposed by some browsers for plug-in scripting.
Even if a browser and operating system combination are not listed above, they should support
the ExternalInterface class if they support the NPRuntime API.
See
Note: When embedding SWF files within an HTML page, make sure that the
. - + ~~ / \
Note for Flash Player applications: Flash Player version 9.0.115.0 and later allows the
Note for Flash Player applications: In Flash Player 10 and later running in a browser, using this class programmatically to open a pop-up window may not be successful. Various browsers (and browser configurations) may block pop-up windows at any time; it is not possible to guarantee any pop-up window will appear. However, for the best chance of success, use this class to open a pop-up window only in code that executes as a direct result of a user action (for example, in an event handler for a mouse click or key-press event.)
From ActionScript, you can do the following on the HTML page:
From JavaScript on the HTML page, you can:
Note for Flash Player applications: Flash Player does not currently support SWF files embedded within HTML forms.
Note for AIR applications: In Adobe AIR, the ExternalInterface class can be used to communicate between JavaScript in an HTML page loaded in the HTMLLoader control and ActionScript in SWF content embedded in that HTML page.
Note: Repeating
Note: For local content running in a browser, calls to the
If the container is an HTML page, this method invokes a JavaScript function
in a
If the container is another ActiveX container, this method dispatches the FlashCall ActiveX event with the specified name, and the container processes the event.
If the container is hosting the Netscape plug-in, you can either write custom support for the new NPRuntime interface or embed an HTML control and embed the player within the HTML control. If you embed an HTML control, you can communicate with the player through a JavaScript interface to the native container application.
Note: For local content running in a browser, calls to the
Note for Flash Player applications: In Flash Player 10 and Flash Player 9 Update 5, some web browsers restrict this method if a pop-up blocker is enabled. In this scenario, you can only call this method successfully in response to a user event (for example, in an event handler for a mouse click or keypress event).
Note: When using the External API with HTML, always check that the HTML has finished loading before you attempt to call any JavaScript methods.