Created
June 8, 2012 13:24
-
-
Save sacrifs/2895591 to your computer and use it in GitHub Desktop.
シンボル名からインスタンス名を付けるJSFL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* rename instance name from the selected symbol name. | |
*/ | |
var _doc = fl.getDocumentDOM(); | |
function main(){ | |
fl.outputPanel.clear(); | |
var selectedItems = _doc.selection; | |
var numItem = selectedItems.length; | |
if(numItem == 0){ | |
fl.trace('nothing...'); | |
} | |
else{ | |
for(i = 0; i < numItem; i++){ | |
var elem = selectedItems[i]; | |
setName(elem); | |
} | |
fl.trace('complete!'); | |
} | |
} | |
/** | |
* setName | |
* @param elem:Element | |
*/ | |
function setName(elem){ | |
var item = elem.libraryItem; | |
var splName = item.name.split("/"); | |
elem.name = splName[splName.length - 1]; | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment