Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 504

Programming actionscript 3.0
Table of Contents

Advertisement

Getting information about the external container
The
ExternalInterface.available
in a container that offers an external interface. If the external interface is available, this
property is
; otherwise, it is
true
ExternalInterface class, you should always check to make sure that the current container
supports external interface communication, as follows:
if (ExternalInterface.available)
{
// Perform ExternalInterface method calls here.
}
The
ExternalInterface.available
type that supports ExternalInterface connectivity. It will not tell you if JavaScript is
enabled in the current browser.
The
ExternalInterface.objectID
of the Flash Player instance (specifically, the
Explorer or the
name
interface). This unique ID represents the current SWF document in the browser, and can be
used to make reference to the SWF document—for example, when calling a JavaScript
function in a container HTML page. When the Flash Player container is not a web browser,
this property is
.
null
Calling external code from ActionScript
The
ExternalInterface.call()
requires at least one parameter, a string containing the name of the function to be called in the
container application. Any additional parameters passed to the
method are passed along to the container as parameters of the function call.
// calls the external function "addNumbers"
// passing two parameters, and assigning that function's result
// to the variable "result"
var param1:uint = 3;
var param2:uint = 7;
var result:uint = ExternalInterface.call("addNumbers", param1, param2);
504
Using the External API
property indicates whether the current Flash Player is
. Before using any of the other functionality in the
false
property reports whether the current container is a
property allows you to determine the unique identifier
attribute of the
<embed>
method executes code in the container application. It
attribute of the
id
<object>
tag in browsers using the NPRuntime
ExternalInterface.call()
tag in Internet

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents