From ActionScript, you can call a JavaScript function on the HTML page. The External API
offers the following improved functionality compared with
You can use any JavaScript function, not only the functions that you can use with the
■
function.
fscommand()
You can pass any number of arguments, with any names; you aren't limited to passing a
■
command and a single string argument. This gives the External API much more flexibility
than
fscommand()
You can pass various data types (such as Boolean, Number, and String); you are no longer
■
limited to String parameters.
You can now receive the value of a call, and that value returns immediately to ActionScript
■
(as the return value of the call you make).
If the name given to the Flash Player instance in an HTML page (the
attribute) includes a hyphen (
JavaScript (such as
not work when the container web page is viewed in Internet Explorer.
In addition, if the HTML tags that define the Flash Player instance (the
tags) are nested in an HTML
<embed>
ActionScript will not work.
Using the ExternalInterface class
Communication between ActionScript and the container application can take one of two
forms: either ActionScript can call code (such as a JavaScript function) defined in the
container, or code in the container can call an ActionScript function that has been designated
as being callable. In either case, information can be sent to the code being called, and results
can be returned to the code making the call.
To facilitate this communication, the ExternalInterface class includes two static properties and
two static methods. These properties and methods are used to obtain information about the
external interface connection, to execute code in the container from ActionScript, and to
make ActionScript functions available to be called by the container.
.
) or other characters that are defined as operators in
-
,
,
,
,
, and so on), ExternalInterface calls from ActionScript will
+
*
/
\
.
<form>
fscommand()
tag, ExternalInterface calls from
Using the ExternalInterface class
:
tag's
<object>
id
and
<object>
503