![MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference Download Page 554](http://html.mh-extra.com/html/macromedia/flash-8-actionscript-2-0-language/flash-8-actionscript-2-0-language_reference_687537554.webp)
554
ActionScript classes
If the container is hosting the Netscape plug-in, you can either write custom support for the
new NPRuntime interface or embed an HTML control and embed Flash Player within the
HTML control. If you embed an HTML control, you can communicate with Flash Player
through a JavaScript interface that talks to the native container application.
Availability:
ActionScript 1.0; Flash Player 8
Parameters
methodName
:String
- The name of the function to call in the container. If the function
accepts parameters, they must appear following the
methodName
parameter.
parameter1
:Object
[optional] - Any parameters to be passed to the function. You can
specify zero or more parameters, separating them by commas. The parameters can be of any
ActionScript data type. When the call is to a JavaScript function, the ActionScript types are
automatically marshalled into JavaScript types. When the call is to some other ActiveX
container, the parameters are encoded in the request message.
Returns
Object
- The response received from the container. If the call failed (for example if there is no
such function in the container, or the interface was not available, or a recursion occurred, or
there was a security issue)
null
is returned.
Example
The following example calls the JavaScript function
sayHello()
in the HTML page that
contains the SWF. The call is made by using the
ExternalInterface.call()
method.
import flash.external.*;
var greeting:String;
var btn:MovieClip = createButton(100, 30, 0xCCCCCC);
btn.onPress = function() {
greeting = String(ExternalInterface.call("sayHello", "browser"));
this.mcTxt.text = greeting; // >> Hi Flash.
}
function createButton(width:Number, height:Number, color:Number):MovieClip
{
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
var mcFmt:TextFormat;
mc.beginFill(color);
mc.lineTo(0, height);
mc.lineTo(width, height);
mc.lineTo(width, 0);
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...