Hi,
I see that attachSound is gone and you have to instantiate a sound object in replacement.
In other words I can no longer do this:
var S:Sound = new Sound(this);
S.attachSound("SoundLinkedInLibrary");
S.start(0,0);
I have to do:
var S:Sound = new SoundLinkedInLibrary();
S.play(0,0);
;
However, this is a big problem! I would like to play a random sound from my library! How can I do this without having if statements?
I used to be able to do this:
var S:Sound = new Sound(this);
S.attachSound("MusicTrackNumber"+random(5));
S.start(0,0);
But I don’t see a way of doing this in AS 3? It seems like I have to do:
var rand:Number = Math.floor(Math.randon()*5);
var S:Sound;
if (rand == 0)
S = new MusicTrackNumber0();
else if (rand == 1)
S = new MusicTrackNumber1();
else if...
//etc
There MUST be a way. Does anyone have any idea or methods they’d like to share?
Thanks!
-Danny