Aligning to Stage top-left with JSFL in Flash IDE CS5
See Tit开发者_开发百科le.
I'd do it by hand but there are 200+ .fla files that have been centered in the middle of the stage that I then load into AS3 (Flash Builder 4).
Thanks for the help. Jono
You could offset the content once it's loaded, straight from as3, but here's the jsfl:
var dir = fl.browseForFolderURL("select fla folder");//open a folder
var files = FLfile.listFolder(dir,"files");//get the files (note: NOT recursive!)
var filesNum = files.length;
fl.outputPanel.clear();
for(var i = 0 ; i < filesNum; i++){
if(files[i].substr(files[i].lastIndexOf(".")+1) == 'fla'){//look for fla's
var doc = fl.openDocument(dir+'/'+files[i]);
//do whatever to your document here
doc.selectAll();
doc.group();
doc.align('top', true);
doc.align('left', true);
doc.unGroup();
doc.selectNone();
fl.saveDocument(doc);
fl.closeDocument(doc,false);
fl.trace(files[i]+' done');
}
}
fl.trace('all done!');
Luckily you're using CS5, so should be fine. If you're using a previous version, replace fl.saveDocument() with fl.saveAndCompact(), as I experienced a bug there.
Note that it prompts for a folder containing fla files, but it doesn't step through neste folders.
If the fla. files aren't very complex, it should be fine, otherwise, you might encounter some errors when Flash has enough.
精彩评论