Groups | Blog | Home
all groups > flash (macromedia) > december 2006 >

flash (macromedia) : Playing audio files


atalata
12/7/2006 9:56:04 PM
Can someone help me with this please? I need to create a couple of buttons in
flash. I already created them. But I need to be able to play a wav file (audio
file) when the button is clicked on. Also if I click on another button, the
playing file should stop playing and the other audio should play. Can someone
please help me with this ? Appreciate it!
Thanks!!!!:confused;:cool;:disgust;:cool;:confused;
dan mode ->Adobe Community Expert
12/8/2006 1:12:49 PM
Place the wav file into a movieClip by importing it into Flash (File >
Import). Put a stop(); on frame one of this clip.
Place the clip on the stage with an instance name of myMC.

If the instance name of your play button is myBtnPlay then use this
actionscript, place it on frame one of the main timeline:

myBtnPlay.onRelease = function(){
myMC.play();
}

//If the instance name of your stop button is myBtnStop then use this
actionscript:

myBtnStop.onRelease = function(){
myMC.stop();
//to make it go back to the beginning of the audio use
myMC.gotoAndStop(1);
}

hth

--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com
*Must Read* http://www.smithmediafusion.com/blog


[quoted text, click to view]

AddThis Social Bookmark Button