/* Sequantially Name Instances Sequentially names all selected instances onstage. Jeff Ahlquist and Jen deHaan November 24, 2008 */ var theSelectionArray = fl.getDocumentDOM().selection; var visibleIndex = 0; function SetName(theElem, prefix) { theElem.name = prefix + "_" + visibleIndex; visibleIndex++; } if (theSelectionArray.length > 0) { var prefix = prompt("Please enter prefix for instance names.", "myInstance"); if (prefix != null) { for(var i=0; i< theSelectionArray.length; i++) { var theElem = theSelectionArray[i]; if (theElem instanceof SymbolInstance) { // NOTE: This also catches instanceof ComponentInstance, so no need to check for them. switch(theElem.symbolType) { case "button": case "movie clip": SetName(theElem, prefix, visibleIndex); continue; break; case "graphic": // Do NOT set the name for graphic symbol break; } } if (theElem instanceof Text) { switch(theElem.textType) { case "dynamic": case "input": SetName(theElem, prefix, visibleIndex); continue; break; case "static": // Do NOT set the name for static text break; } } if (theElem instanceof CompiledClipInstance) { SetName(theElem, prefix, visibleIndex); continue; } if (theElem instanceof Video) { SetName(theElem, prefix, visibleIndex); continue; } if (theElem instanceof Bitmap) { // Bitmaps do not have names } if (theElem instanceof Shape) { // Shapes do not have names } } } } else { alert("Please select the instances you want to name."); }