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

----- Original Message ----- From: "Paul Steven" <paul_ste...@btinternet.com>
To: "'Flash Coders List'" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, April 08, 2009 8:30 AM
Subject: [Flashcoders] Dragging loads of sound files from library into amovie 
clip


Related to my previous post, I now need to drag about 300 audio files from
the library into a movie clip.

Essentially this is to ensure they are preloaded in my game. The method I
use is to create a movie clip that has all the audio files on separate
layers. This movie clip is then nested inside another movie clip and placed
on the second keyframe with a stop action on the first.

I am wondering if there is a magic way to drag say 300 audio files from the
library and for flash (Flash CS3) to automatically create 300 layers, one
layer for each audio file?

Thanks in advance

Paul

_______________________________________________
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