beautypg.com

Fl.selecttool() – Adobe Extending Flash Professional CS4 User Manual

Page 275

background image

253

EXTENDING FLASH CS4 PROFESSIONAL

flash object (fl)

var nameToSearchFor = "second text field";

var doc = fl.getDocumentDOM();

// Start by viewing Scene 1 (index value of 0).

document.editScene(0);

// Search for element by name.

var results = fl.findObjectInDocByName(nameToSearchFor, doc);

if (results.length > 0) {

// Select the first element found.

// Pass false, so the symbolInstance you are searching for is selected.

// If you pass true, the symbol instance will switch to edit mode.

fl.selectElement(results[0], false);

alert("success, found " + results.length + " objects")

}

else {

alert("failed, no objects with name "" + nameToSearchFor + "" found");

}

See also

fl.findObjectInDocByName()

,

fl.findObjectInDocByType()

fl.selectTool()

Availability
Flash CS3 Professional.

Usage

fl.selectTool(toolName)

Parameters

toolName

A string that specifies the name of the tool to select. See “Description” below for information on acceptable

values for this parameter.

Description
Method; selects the specified tool in the Tools panel. The acceptable default values for toolName are

"arrow"

,

"bezierSelect"

,

"freeXform"

,

"fillXform"

,

"lasso"

,

"pen"

,

"penplus"

,

"penminus"

,

"penmodify"

,

"text"

,

"line"

,

"rect"

,

"oval"

,

"rectPrimitive"

,

"ovalPrimitive"

,

"polystar"

,

"pencil"

,

"brush"

,

"inkBottle"

,

"bucket"

,

"eyeDropper"

,

"eraser"

,

"hand"

, and

"magnifier"

.

If you or a user creates custom tools, the names of those tools can also be passed as the toolName parameter. The list
of tool names is located in the following file:

Windows Vista:

boot drive\Users\username\Local Settings\Application Data\Adobe\Flash
CS3\language\Configuration\Tools\toolConfig.xml

Windows XP:

boot drive\Documents and Settings\username\Local Settings\Application Data\Adobe\Flash
CS3\language\Configuration\Tools\toolConfig.xml