|
Flash CS4 Resources |
fl.selectElement()Parameters
DescriptionMethod; enables selection or editing of an element. Generally, you will use this method on objects returned by fl.findObjectInDocByName() or fl.findObjectInDocByType(). ExampleThe 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");
}
|