I've just been writing a tonne of JSFL scripts for a project so have done a
lot of this. Here's a few generic lines grabbed form some of my scripts...
<code>

var focussedDoc = fl.getDocumentDOM();
var targetLibrary = focussedDoc.library;
var selectedItems = targetLibrary.getSelectedItems();
for( i = 0; i < selectedItems.length; i++ ) {
targetLibrary.editItem( selectedItems[i].name );
 var editingTimeline = fl.getDocumentDOM().getTimeline();
for( e = 0; e < editingTimeline.layers[0].frames[0].elements.length; e++ ) {
var currentElement = editingTimeline.layers[0].frames[0].elements[e];
currentElement.x = 0 + currentElement.width/2;
currentElement.y =  0 + currentElement.height/2;
}
}
focussedDoc.exitEditMode();

</code>

To use this:
1) Select all the symbols in the library you would like to align
2) run the command

Note:
- It assumes that each library symbol consists of only a single frame and a
single layer. If there are more layers and frames you'll need to iterate
through each of them using the editingTimeline.layers and
editingTimeline.layers[x].frames arrays.
- It will align all elements on a single frame so the top left corners of
their bounding boxes are at 0,0
- all raw shapes on a single frame are treated as a single element. They
need to be grouped or converted to symbols to be treated individually by
JSFL
- it will return your editing focus to the main timeline upon completion

Without knowing more about the exact structure of your symbols it's a little
difficult to be more precise with the code but this should give you the
basics you need to customise your own script.

HTH
Adrian Park


On Fri, Feb 15, 2008 at 3:13 PM, Some Dude <[EMAIL PROTECTED]>
wrote:

> Does anybody know what the jsfl would look like to automate the process of
> aligning movieclips to the top left as opposed to centered? I have a cs3
> fla
> with lots of symbols that need to be aligned top left. Thanks if anybody
> can
> help.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to