Friday, April 10, 2009

ExternalInterface - Flash CS4 Professional ActionScript 3.0 Language Reference

ExternalInterface - Flash CS4 Professional ActionScript 3.0 Language Reference


Language Version: ActionScript 3.0
Runtime Versions: Flash Player 9, AIR 1.0

The ExternalInterface class is the External API, an application programming interface that enables straightforward communication between ActionScript and the Flash Player container– for example, an HTML page with JavaScript. Adobe recommends using ExternalInterface for all JavaScript-ActionScript communication.

You can call an ActionScript function in Flash Player, 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 fscommand() method.

From ActionScript, you can do the following on the HTML page:

* Call any JavaScript function.
* Pass any number of arguments, with any names.
* Pass various data types (Boolean, Number, String, and so on).
* Receive a return value from the JavaScript function.

From JavaScript on the HTML page, you can:

* Call an ActionScript function.
* Pass arguments using standard function call notation.
* Return a value to the JavaScript function.

Flash Player does not currently support SWF files embedded within HTML forms.

Note: 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.

No comments:

Post a Comment