:beam: :beam: :beam: kickass soulty thanks a lot man!! you have saved me headaches of trying to figure out code! The thing is i have crazy ideas and just putting them together is hard and than comes the coding!
Ok i got everything working with multiple songs at the same type
mySound = new Sound();
mySound1 = new Sound();
1st button
on (release) {
mySound.loadSound(“rain.mp3”, true);
}
2nd button
on (release) {
mySound1.loadSound(“red.mp3”, true);
}
Well lets say i want to have a pause button how would i do that?? I tried
on (press) {
if (playing==true) {
_root.mySound1.stop(“mySound1”);
_root.mySound.stop(“mySound”)
playing=false;
}
}
actually i found the answer to my own question here it is for people who are following!
Button 1
on(press) {
if (playing!=true) {
if (playing=true);
soundIsLoaded=1
mySoundObject1=new Sound();
mySoundObject1.setVolume(55);
mySoundObject1.loadSound(“rain.mp3”,true) //streaming
}
_root.mySoundObject1.onSoundComplete=function()
{playing=false;}
}
Button 2
on(press) {
if (playing!=true) {
if (playing=true);
soundIsLoaded=1
mySoundObject=new Sound();
mySoundObject.setVolume(55);
mySoundObject.loadSound(“red.mp3”,true) //streaming
}
_root.mySoundObject.onSoundComplete=function()
{playing=false;}
}
Stop Button
on(press) {
if (playing==true) {
playing=false;
mySound.stop()
mySound1.stop()
}
}
Now what would i do if i just wanted to have ONE BUTTON just like on the cd player whereu have one button that advances to the next song and the other one that goesk back the the last song!
good to hear you got it all working, for the next and previous buttons you are trying maybe you can use a array, so you can list the mp3’s in this array. and with some code, have the button increment along the array each time its clicked,
I don’t really know how to use array’s, but its worth a look at.
i would also like to know how to do this, (Bump , as people would say)
songArray= ["rain.mp3", "song2.mp3", "song3.mp3"];
songNum=0; //first position of array = 0
function loadNext(){
songNum+=1 %songArray.length;
//increments songNum, mods arrayLength so that it will
//return back to 0 after array length is exceeded
myName=songArray[songNum];
mySound.loadSound(myName, true);
}
Hey Soulty just liked to say thanks for the help you gave me , it really made me go nuts and crazy about the code , searching and everything!
Heres another question.
I have the website and in the beginning i have preloader but the song i want to put is quite big so i want when the preloader is done loading that it would start streaming the music. How would i be able to do so?
put the function and new array code on your main timeline
add the function call to your button:
on(release){
_root.loadNext();
}
afa streaming the first song/sound, put your new Sound() command inside the main movie frame, or wherever the preloader goes after its done–this way, the user can see the content, and the sound object will load the sound in the background…
-mojo
//set array of mp3 names
songArray=_["dum.mp3",_"song2.mp3",_"song3.mp3"];
//track position in array
songNum=0;_//first position of array = 0
//create dynamic var referencing song name in array list
myName=songArray[songNum];
mySound= new Sound(myName, true);
function_loadNext(){
songNum+=1_%songArray.length
myName=songArray[songNum];
mySound = new Sound(myName, true);
mySound.play();
then you can call my sound anytime you want to start
put this code on your button:
on(release){
_root.loadNext();
basically what your’e doing here is creating an array and function on the root level, and then calling the function from your button–make sense?
-m
oops, my code got a little mangled–those underscores shouldn’t be in there, plus i wrote some of it wrong (i didn’t have flash handy when i wrote it:blush: )
anyway, i fixed it up and attached a movie w. the code and a button–this will hopefully help you get it going again…
cheers,
-mojo
Creating engaging and entertaining content for designers and developers since 1998.