Flash CS4 Professional ActionScript 2.0

ExternalInterface (flash.external.ExternalInterface)

 Object
    |
    +-flash.external.ExternalInterface

public class ExternalInterface
extends  Object

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, or a desktop application with Flash Player embedded.

ExternalInterface is similar in functionality to the fscommand(), CallFrame() and CallLabel() methods, but is more flexible and more generally applicable. Use of ExternalInterface is recommended for JavaScript-ActionScript communication.

From ActionScript, you can call any JavaScript function on the HTML page, passing any number of arguments of any data type, and receive a return value from the call.

From JavaScript on the HTML page, you can call an ActionScript function in Flash Player. The ActionScript function can return a value, and JavaScript receives it immediately as the return value of the call.

ExternalInterface is supported in the following combinations of browser and operating system:

Browser

Operating System

Internet Explorer 5.0 and higher

 Windows 

 

Netscape 8.0 and higher

 Windows 

 Macintosh 

Mozilla 1.7.5 and higher

 Windows 

 Macintosh 

Firefox 1.0 and higher

 Windows 

 Macintosh 

Safari 1.3 and higher

 

 Macintosh 

ExternalInterface requires the user's web browser to support either ActiveX or the NPRuntime API that is exposed by some browsers for plugin scripting. See http://www.mozilla.org/projects/plugins/npruntime.html.

Availability: ActionScript 1.0; Flash Player 8

Property summary

Modifiers

Property

Description

static

available: Boolean [read-only]

Indicates whether this player is in a container that offers an external interface.

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)

Method summary

Modifiers

Signature

Description

static

addCallback(methodName: String, instance: Object, method: Function) : Boolean

Registers an ActionScript method as callable from the container.

static

call(methodName: String, [parameter1: Object]) : Object

Calls a function exposed by the Flash Player container, passing 0 or more arguments.

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)