Copy link to clipboard
Copied
Hi,
I've been trying to get some music to play when the user clicks (its for a mute and unmute button)
I've got the mute button to work with the stop all sounds code snippet. I tried to adapt it and this is what I have:
//unmute sound
instVolOn.addEventListener(MouseEvent.CLICK, Unmute);
function Unmute(event:MouseEvent):void
{
SoundMixer.Playl(welcomeMusic.mp3);
}
Safe to say it didn't work, can someone help?
Thanks,
Jack
It's difficult to tell exactly what you are attempting from your code. If you have created a sound object and attached a sound file from your movie's Library to that sound object then you should play and pause or stop that sound through the sound object. If your sound is embedded into a layer on your timeline then you can stop the sound through the SoundMixer object but you can't play it. The sound is playing wild on the timeline and once it's stopped it stays stopped.
Here's an Adobe help file t
...Copy link to clipboard
Copied
I don't think "Playl" is a real word. I tried googling "SoundMixer.Playl", and this forum post was the only result I could find.
Perhaps delete the "l"?
Copy link to clipboard
Copied
After I posted I noticed the l and removed it from my code and it still didn't work - thought it was a rookie mistake!
Thanks,
Jack
Copy link to clipboard
Copied
try "play" with lowercase "p"
Copy link to clipboard
Copied
try "play" with lowercase "p"
Copy link to clipboard
Copied
It's difficult to tell exactly what you are attempting from your code. If you have created a sound object and attached a sound file from your movie's Library to that sound object then you should play and pause or stop that sound through the sound object. If your sound is embedded into a layer on your timeline then you can stop the sound through the SoundMixer object but you can't play it. The sound is playing wild on the timeline and once it's stopped it stays stopped.
Here's an Adobe help file that explains working with sounds in detail: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d21.html
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can restart sounds fine using a two-frame movieclip. Sound in first frame as Start or Event, then a keyframe and a stop statement in the second frame. To restart the sound just tell the clip to play again.