Fl.selectelement(), Fl.selecttool() – Adobe Extending Flash Professional CS5 User Manual
Page 278

256
EXTENDING FLASH PROFESSIONAL
flash object (fl)
Last updated 5/2/2011
fl.selectElement()
Availability
Flash CS3 Professional.
Usage
fl.selectElement(elementObject, editMode)
Parameters
elementObject
The
editMode
A Boolean value that specifies whether you want to edit the element (
true
) or want only to select it (
false
).
Returns
A Boolean value of
true
if the element was successfully selected;
false
otherwise.
Description
Method; enables selection or editing of an element. Generally, you will use this method on objects returned by
.
Example
The following example selects an element named "
second text field
" if one is found in the document:
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.selectTool()
Availability
Flash CS3 Professional.