This will add the audio mc to the main timeline in frame 10 (add it after
doc.exitEditMode(); in the previous script):
// main timeline
tl = doc.getTimeline();
frIndex = tl.addNewLayer("ALL AUDIO");
tl.insertFrames(10);
tl.insertBlankKeyframe(10);
tl.currentFrame = 10;
lib.addItemToDocument({x:0, y:0}, "mc:audio");
Depending on how your FLA is built up, you may have to remove:
tl.insertFrames(10)
regards,
Muzak
----- Original Message -----
From: "Muzak" <p.ginnebe...@telenet.be>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, April 09, 2009 4:27 PM
Subject: Re: [Flashcoders] Dragging loads of sound files from library
intoamovie clip
Hey Paul,
Use jsfl again..
- create a new movieclip in library (mc:audio)
- edit the movieclip (enter editMode)
- loop through all library items
- if item == "sound"
- create new layer in movieclip
- add sound to new layer
fl.outputPanel.clear();
fl.trace("Audio to MovieClip Command");
var doc = fl.getDocumentDOM();
var lib = doc.library;
// create movieclip for audio
lib.addNewItem("movie clip", "mc:audio");
lib.setItemProperty("linkageExportForAS", false);
lib.setItemProperty("linkageExportForRS", false);
lib.editItem("mc:audio");
var tl = doc.getTimeline();
var libItems = lib.items;
var len = libItems.length;
var item;
var frIndex;
fl.trace("library items: " + len);
for(var i=0; i<len; i++) {
item = libItems[i];
//fl.trace(" - item: "+ item);
//fl.trace(" - item type: " + item.itemType);
if(item.itemType == "sound") {
// create layer in movieclip, give it the audio name
frIndex = tl.addNewLayer(item.name);
fl.trace(" - creating layer for: " + item.name);
// add sound (current library item) to new layer
tl.layers[frIndex].frames[0].soundLibraryItem = item;
}
}
doc.exitEditMode();
fl.trace("==================================");
Additionally you can add some more commands to actually add the audio movieclip from the library to the main timeline in a
specific frame (for preloading).
You should be able to figure that out from the jsfl docs :)
regards,
Muzak
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders