Loading random sound loops

Objective:
Everytime a user enters this site, I’d like to have a different sound loop load.
This is the code I am using to load the single sound clip.

mySound = new Sound();
mySound.attachSound(“wav”);

This sound is also controled by a volume slider once it has loaded. Here is the code:
onClipEvent (load) {
top = _y;
left = _x-48;
right = _x;
bottom = _y;
_x = _root.volume_level;
}
onClipEvent (enterFrame) {
if (dragging) {
_root.mySound.setVolume(100+((_x-right)*2.1));
}
}


So can anyone tell me how to load a random sound clip (1of3) and then allow the slider control to “control” that partcular clip?

THANKS a TON!

make an array with values 0-2 (that will be 3 choices) … each value will correspond to one of your song titles and when it’s selected it will play the song … then just put a random number picker math.random(2); before it

that should pick a number then play that number from the array … onLoad

i think that’ll work

pom?
inigo?
shuga? … oh wait … thats me :stuck_out_tongue:

Hi and thanks for replying. I think I am understanding you but would you have any code that you could copy and paste in? I want to be sure I set the code up correctly. Would be a HUGE help.

Again, thanks!!!
G

i don’t know how to make an array yet … i just know what they do but lemme see if i can find a sample that i think might work

i’ll post it in a few mins


i=_root.math.random(2);
var myArray=new Array("mySong1.mp3","mySong2.mp3","mySong3.mp3");
mySound=newSound();
mySound.loadSound(myArray*,true);
mySound.start;

apparently pom and inigo … or any of the other gurus aren’t around today.

this is what i came up with and it’s not working for me yet … but i have to leave work now … so i’ll have to mess with it more later. sorry i’m not the most knowledgable person at actionscripting … i’m learning too :slight_smile:

anyway … you should look around for tutorials and information on Arrays on the web or even on Kirupa.com … there are lots of resources out there … if i get it to work … i will certainly post it here

hope this helps … atleast a little bit

if any guru looks at my code … i’m getting an error when i trace the value of i … i get “undefined” in the error window. so i’m not sure how to fix that … i thought i supplied what i was supposed to be and where it was to be applied … but i dunno :slight_smile:

thanks alot for the effort. i’ll keep working it and if i figure it out i’ll post it here.