Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > JSFL - Extending Flash

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-11-2005, 07:55 PM   #1
aja
Registered User
 
aja's Avatar
 
Join Date: Apr 2004
Location: montréal
Posts: 19
Default 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:
ActionScript Code:
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:
ActionScript Code:
fl.getDocumentDOM().library.items[0].exportSWF("file:///c|/tests/my.swf");

any clue?
aja is offline   Reply With Quote
Old 04-12-2005, 11:57 AM   #2
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

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
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-12-2005, 08:27 PM   #3
aja
Registered User
 
aja's Avatar
 
Join Date: Apr 2004
Location: montréal
Posts: 19
Default

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?
aja is offline   Reply With Quote
Old 04-12-2005, 09:49 PM   #4
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

i did it a bit differently. i copied a symbol from my library into a new fla, and exported that. here is the code:
ActionScript 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.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-12-2005, 10:11 PM   #5
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

edit, i reread you title, sorry got sidetracked there.
let me check it out, i will get back to you in the morning.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-12-2005, 10:39 PM   #6
aja
Registered User
 
aja's Avatar
 
Join Date: Apr 2004
Location: montréal
Posts: 19
Default

No worries, the code you just post made me look further in my jsfl learning.
and thanks for your time.
aja is offline   Reply With Quote
Old 04-13-2005, 10:14 AM   #7
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

ok gotit. took me 10 min this morning to figure it, but its good i did, inline with something i want to do soon.

ActionScript Code:
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
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-13-2005, 06:09 PM   #8
aja
Registered User
 
aja's Avatar
 
Join Date: Apr 2004
Location: montréal
Posts: 19
Default

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?
aja is offline   Reply With Quote
Old 04-13-2005, 06:17 PM   #9
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

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.
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Old 04-13-2005, 07:23 PM   #10
aja
Registered User
 
aja's Avatar
 
Join Date: Apr 2004
Location: montréal
Posts: 19
Default

ok thanks, I managed to make it work using
ActionScript Code:
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.
aja is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.