Dreamweaver.flash.executescript() – Adobe Dreamweaver API Reference CS5 User Manual

Page 53

Advertising
background image

48

DREAMWEAVER API REFERENCE

Flash integration

Last updated 8/27/2013

Arguments

controlID

,

javascript function call

•

The

controlID

argument is the ID of the extension to execute the script. This ID must match with the ID specified

as the first parameter to the

dw.flash.newControl()

.

•

The JavaScript function call argument enables the user to call a function with any number of parameters.

Returns
A Boolean value:

true

if the function executed successfully;

false

otherwise.

dreamweaver.flash.executeScript()

Availability
Dreamweaver CS4.

Description
The function is used to execute functions in a .js file. The ActionScript in the .swf file starts the

dreamweaver.flash.executeScript()

function.

Arguments

javascript function call

Note: Specify a path to the .js file that contains the functions you want to call.

Returns
An XML string that serializes into an ActionScript object.

Example
The following example contains a sample file, Sample.mxml and a JavaScript function in a JavaScript file, Sample.js.

private function executeScript():void

{

if(ExternalInterface.available)
{

out.text += "SwfCalledHost\n";
var scriptText:String = "helloWorld('scott');\n";
var resultStr:Object =

ExternalInterface.call("dw.flash.executeScript",scriptText);

out.text += "Result: " + resultStr.strResult + '\n';

}

}

The following JavaScript file contains a JavaScript function

helloWorld()

that is called from the .swf. This function

uses the

dw.getAppLanguage()

call to return a five-letter language code that Dreamweaver is running in Sample.js.

Advertising