Wow this jsfl is a life saver! Can't believe I had never heard about it
before in all the years I have been using Flash.

Thank you Muzak for taking the time to write the code out for me. It works a
dream!

Cheers

Paul

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Muzak
Sent: 09 April 2009 15:27
To: Flash Coders List
Subject: Re: [Flashcoders] Dragging loads of sound files from library into
amovie 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

----- Original Message ----- 
From: "Paul Steven" <[email protected]>
To: "'Flash Coders List'" <[email protected]>
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
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to