Created
December 1, 2010 22:19
-
-
Save debreuil/724337 to your computer and use it in GitHub Desktop.
moveToTL.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
// move all elements selected in the library to 0,0 | |
fl.outputPanel.clear(); | |
var trace = fl.trace; | |
fl.showIdleMessage(false); | |
var doc = fl.getDocumentDOM(); | |
var lib = doc.library; | |
function main() | |
{ | |
var selItems = lib.getSelectedItems(); | |
for(var i = 0; i < selItems.length; i++) | |
{ | |
var itm = selItems[i]; | |
moveToTL(itm); | |
} | |
} | |
function moveToTL(libElement) | |
{ | |
if(libElement.symbolType == "movie clip" || libElement.symbolType == "graphic") | |
{ | |
lib.editItem(libElement.name); | |
doc.selectAll(); | |
if(doc.selection.length > 0) | |
{ | |
var sel = doc.selection[0]; | |
sel.x = sel.width / 2; | |
sel.y = sel.height / 2; | |
} | |
doc.selectNone(); | |
doc.exitEditMode(); | |
} | |
} | |
function traceProps(obj) | |
{ | |
for(var o in obj) | |
{ | |
trace(o); | |
//var val = obj[o] != undefined ? obj[o] : "null"; | |
//var tp = obj[o] != undefined ? typeof(obj[o]) : "null"; | |
//trace(o + " : " + val + " :: " + tp); | |
} | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment