james
james

Reputation: 2663

Using lots of sound in a AS3 project

I have around 400 sounds in my flash file.

Is there anyway to go about using them with having to instantiate them all.I will be storing them in an array.

var sound1:Sound = snd1;
var soundN:Sound = sndn;

var mySounds:Array =[sound1,soundN....];

I already have linkages in the library as sound1,soundN,etc

Upvotes: 0

Views: 250

Answers (1)

Mattias
Mattias

Reputation: 3907

I usually put the sounds in a separate SWF and then use a JSFL script I have written to generate an array of the sounds id in the SWF. Then I loop through the array and instantiate the sounds using the id in the array. I recommend writing a SoundManager class to do these kind of things for you. I use my JSFL to generate a Type class to easier get access of the sound id.

Something like this:

SoundManager.getInstance().addSounds(soundArray);
SoundManager.getInstance().playSound(SoundList.PLAYER_DIE);

Upvotes: 1

Related Questions