
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 Element object you want to select.
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
fl.findObjectInDocByName() or fl.findObjectInDocByType().
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.findObjectInDocByName(), fl.findObjectInDocByType()
fl.selectTool()
Availability
Flash CS3 Professional.
Commenti su questo manuale