When I run this script from http://help.adobe.com/en_US/flash/cs/extend/WS5b3ccc516d4fbf351e63e3d118a9024f3f-7fb0CS5.html
as simple command
var nameToSearchFor = "instance01";
var doc = fl.getDocumentDOM();
var results = fl.findObjectInDocByName(nameToSearchFor, doc);
if (results.length > 0) {
alert("success, found " + results.length + " objects");
}
else {
alert("failed, no objects named " + nameToSearchFor + " found");
}
everything is ok, but when I want add this code to custom tool i got errors.
Error Script in function mouseDown
function configureTool() {
theTool = fl.tools.activeTool;
theTool.setToolName( "Sew" );
theTool.setIcon( "Sew.png" );
theTool.setMenuString( "Sew" );
theTool.setToolTip( "Sew" );
theTool.setOptionsFile( "Sew.xml" );
theTool.setPI( "shape" );
}
function activate(){
fl.trace("ACTIVATE");
}
function mouseDown(){
var nameToSearchFor = "instance01";
var doc = fl.getDocumentDOM();
var results = fl.findObjectInDocByName(nameToSearchFor, doc);
if (results.length > 0) {
fl.trace("successfound");
}
else {
fl.trace("failed");
}
}
function deactivate() {
fl.trace("End");
}
Why?