View Full Version : Exporting MovieClips From the Timeline Instead of the Library
Is there a way to export a mc from the timeline instead of from the library? I'm thinkin' of something like this:
fl.getDocumentDOM().getTimeline().layers[0]
.frames[0].elements[0].exportSWF("file:///c|/tests/my.swf");
it keeps saying TypeError:fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].exportSWF("file:///c|/tests/my.swf"); is not a function
instead of from the library:
fl.getDocumentDOM().library.items[0].exportSWF("file:///c|/tests/my.swf");
any clue?
hangalot
04-12-2005, 11:57 AM
create a new document object. copy that timeline element to the stage of the new document, and export that item. there is a marked difference between the library and the stage, so expect different behaviour
mkay, I've done something like this:
for (var i = 0; i < frmArray.length; i++){
fl.getDocumentDOM().getTimeline().copyFrames(i);
fl.createDocument();
fl.getDocumentDOM().getTimeline().pasteFrames();
fl.getDocumentDOM().exportSWF("file:///"+realPath+"slide"+(i+1)+".swf");
fl.getDocumentDOM().close(false);
}
but it makes movies of 1KB
was that the way you meant?
what I'm doing wrong?
hangalot
04-12-2005, 09:49 PM
i did it a bit differently. i copied a symbol from my library into a new fla, and exported that. here is the code:
var doc = getDocumentFromName(flaName);
var lib = doc.library;
var libItemsArr = lib.items;
var itemToCopy = libItemsArr[lib.findItemIndex(symbolPath)];
newDoc = fl.createDocument();
newDoc.addItem({x:0,y:0}, itemToCopy);
newDoc.exportSWF(exportPath);
remember that if that symbol has childSymbols those will go along. also remember that if those items in folders, under certain circumstances the library folder structure of the new fla will look different than what you had.
hangalot
04-12-2005, 10:11 PM
edit, i reread you title, sorry got sidetracked there.
let me check it out, i will get back to you in the morning.
No worries, the code you just post made me look further in my jsfl learning.
and thanks for your time.
hangalot
04-13-2005, 10:14 AM
ok gotit. took me 10 min this morning to figure it, but its good i did, inline with something i want to do soon.
var doc = fl.getDocumentDOM();
//var sel = doc.selection;
//var item = sel[0]
doc.clipCopy()//copiues the current selection - look above for some ideas how to modify the selection
newDoc = fl.createDocument();
newDoc.clipPaste(false);//the boolean indicates it should paste in the same position like shift-paste
its working great, but it keeps exporting the same movie (the selected one). In my source_movie.fla, there is a layer called slides and every slides are in a different keyframe. How can I use clipCopy() for every keyframe?
hangalot
04-13-2005, 06:17 PM
you should be able to walk through each layer and then each frame check what kind of frame it is and then select each element on each frame and then proceed with the code i gave you before.
ok thanks, I managed to make it work using
fl.getDocumentDOM().getTimeline().currentFrame = i;//in a for loop
fl.getDocumentDOM().selectAll();//keeping all other layer locked
but I'm pretty sure there is a better way to do it.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.