PDA

View Full Version : random sound script


pip
04-19-2002, 08:00 PM
I have created 3 soundtracks as per the "Flash Bible" (page 531) directions (all in the same folder as the files) and have entered the Action Script:
randomNum = Math.Round(Math.random () * 3);
loadMovie ("soundtrack" + randomNum + ".swf", 1);
And it still does not work (nothing gets loaded, no images, no sounds)...
Thanks for your help.

Maybe the placement of my Actions within my timeline? Or is there anything wrong with the page 531 directions.
Or maybe some other directions are needed.

Please be clear in your answer as I am new to scripting.

JHallam
04-20-2002, 01:00 PM
How does this work?

Off top of my head

//Call your music music1, music2, music3, etc etc
var num = int( Math.random()*3 + 1 ); //If you have more then 3 swfs of music up the value 3+1 Change the 3!
var str = "music" + num + ".swf";
_root.music.loadMovie(str);



Thanks

pip
04-20-2002, 05:53 PM
Thanks JHallam! I will try your script.