JSFL script for adding sound files to new layers

I have 1012 different sound files named Sound 1, sound 2, sound 3, etc. On the second frame I created a storage movie clip to house them all. What I need to do is add a layer for every sound in the MC and add one sound to each one. Now instead of making 1012 layers by hand, is there a JSFL file I can use to do it for me?

What it needs to do is add one layer, add sound 1, and hit stop in the properties. Then it should add another layer, add sound 2, and hit stop in the properties. I need this to repeat ‘til all the sound files are used.

Why does each one need its own layer? Seems like there could be a better way to do this with AS at run time.

Are all the sounds in the library? What do you mean by hit stop in the properties?

If you have a good answer to the first question I could probably whip something up for you.

I lied and whipped you up something anyways:

var dom = fl.getDocumentDOM();
var tim = dom.getTimeline();

var lib = dom.library.items;
var libLen = lib.length;

for(var i = 0; i < libLen; i++) {
	var ite = lib*
	if(ite.itemType == "sound") {
		var li = tim.addNewLayer("Sound" + i);
		var f = tim.layers[li].frames[0];
		f.soundLibraryItem = ite;
		f.soundSync = "stop";
	}		
}

Run that while you’re inside your movie clip.

Thanks a lot, that worked. One more question. All my identifiers are Sound 841 (name). Is there a jsfl file that can remove all the Sound part of the name?

It’s not recognizing the sound files because all the identifiers have “Sound” in front of it.

It’s this code that adds Sound to it:

var dom = fl.getDocumentDOM();
var tim = dom.getTimeline();

var lib = dom.library.items;
var libLen = lib.length;

for(var i = 0; i < libLen; i++) {
var ite = lib*
if(ite.itemType == “sound”) {
var li = tim.addNewLayer(“Sound” + i);
var f = tim.layers[li].frames[0];
f.soundLibraryItem = ite;
f.soundSync = “stop”;
}
}

how do I stop it?

Nevermind, I’m retarded!

Thank you so much, this has helped out tremendously.

I don’t get it.