This content has been marked as final. Show 5 replies
You probably want to create an array with the names of your sounds/MCs in it. Then you can use the random function to chooose a number that willl than act as the index of your array to chooose one of the sounds/MCs randomly. So, for example:
var myArray:Array = new Array("oneMC","twoMC","threeMC");
var randNum:Number = random(3);
Hope that helps!
I have 19 sounds in my library. I have created a button but would like to have that button play any of those sound clips when pressed. How do I do that?
Thanks in advanced.
You'd do it pretty much how I already described. Make sure to give all of your sounds Linkage names in your Library and check the Export for Actionscript checkbox. Use those linkage names in your array (as described above). Put the random number picker and your player code inside your button click code and you should be good to go.
hI, tried your idea and run into a problem, and wonder if you can spot it - I can't!
For some reason I'm only getting a repeat of sound1 - and not a random pick.
Also wondering if there is some way of checking to see if a sound is playing already and not playing it if it is.
In Director you could do this with the soundbusy command, but I can't find anything similiar in AS.
thansk for your time.