Name
ExternalInterface.addCallback( ): expose an ActionScript method for execution from JavaScript — ActionScript function in Flash 8
Synopsis
boolean ExternalInterface.addCallback(Stringname, Objectinstance, Functionfunc)
Arguments
-
name The name of the JavaScript function to be defined. Invoking a JavaScript function with this name causes the Flash player to invoke the ActionScript function
funcas a method of theinstanceobject.-
instance The ActionScript object on which
funcis to be invoked ornull. This argument becomes the value of thethiskeyword whenfuncis invoked.-
func The ActionScript function that is invoked when the JavaScript function named
nameis invoked.
Returns
true on success or
false on failure.
Description
This static function is used by ActionScript code in a Flash
movie to enable JavaScript code in a web browser to invoke
ActionScript code. When addCallback(
) is invoked, it defines a top-level JavaScript function
called name which, when invoked, calls
the ActionScript function func as a
method of the ActionScript object
instance.
The arguments to the JavaScript function are converted and
passed to func, and the return value of
func is converted and becomes the return value of the JavaScript function. Arguments and return values can be primitive numbers, strings, boolean values, and objects and arrays that contain primitive values. However, it is not possible, for example, to pass a client-side JavaScript object such as a Window or Document to an ActionScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access