PDA

View Full Version : [FMX]Attached sound isn't working



dboers
May 1st, 2004, 11:27 AM
Hi,

I have the following problem. I have a attachSound for three wav files in the library. This is the code:

song1 = new Sound();
song1.attachSound("song1");
song2 = new Sound();
song2.attachSound("song2");
song3 = new Sound();
song3.attachSound("song3");
song1.start();

Nothing wrong so far. When the movie starts, song1 start playing. I have a stop button with the following code:

on (release) {
stopAllSounds();
}

This is also working.When I press the button the music stops. When I press the song1 button, song1 start playing again. But when I press on of the othet two buttons nothing happens. This is the code for the buttons:

on (release){
_root.mc_menu.song1.start();
_root.mc_menu.song2.stop();
_root.mc_menu.song3.stop();
}

What am I doing wrong ?

feiticeria
May 1st, 2004, 06:34 PM
for song2 button:
on (release){
_root.mc_menu.song1.stop();
_root.mc_menu.song2.start();
_root.mc_menu.song3.stop();
}

for song3 button:
on (release){
_root.mc_menu.song1.stop();
_root.mc_menu.song2.stop();
_root.mc_menu.song3.start();
}

Hope that helps.... :thumb:

dboers
May 2nd, 2004, 12:23 AM
Hi,


That is what I have already. Sorry that I wasn't clear enough.

scotty
May 2nd, 2004, 04:57 AM
this.createEmptyMovieClip("temp1", 1);
this.createEmptyMovieClip("temp2", 2);
this.createEmptyMovieClip("temp3", 3);
song1 = new Sound(temp1);
song1.attachSound("song1");
song2 = new Sound(temp2);
song2.attachSound("song2");
song3 = new Sound(temp3);
song3.attachSound("song3");
song1.start();


Give it a try else post your fla;)

scotty(-:

dboers
May 2nd, 2004, 10:20 AM
Thanks a lot. That is working. I thaught I could do without the createEmptyMovieClip.


Thanks :)

scotty
May 2nd, 2004, 01:36 PM
No problem=)
The problem was, that you hadn't defined a target for the Sound object.

scotty(-: