Copy link to clipboard
Copied
Hi,
Am working on Flash cs5.Can anyone tell me how to attach sound to any button?which will play after click on button.this sound should play continue till 2-3 scenes ahead.Am working on project which has 3 button with diffrent sound.and the sound button contains some scene which has volume seter.I mean,if user want to hear that sound in slow,medium or high pitch.the code should set as per this.Its in as 2.
This site is like "karaoke".just the sound is classical music.It will continue on software and user will sing a song.
Can anyone help me?At working on this from last 2 months.and its hard for me to get perfect answer.
mySoundC.start(0,0);
If you've got the answer to the question, close this thread (Answered). Open a new one for your volume slider question.
Copy link to clipboard
Copied
Add your sound clip to the library and give it a Linkage ID of "mySoundClip"
Assume your button is in frame 1.
GIve your button the instance name of "mySoundBtn". And put this code on frame 1 (timeline).
stop();
mySoundBtn.onRelease = function () {
mySoundC = new Sound(this);
mySoundC.attachSound("mySoundClip");
mySoundC.start(0, 10); //10 represents the number of loops
gotoAndPlay(2);
}
than put this code on the timeline frame where you need the sounsd to stop.
stopAllSounds();
Also If you want to be able to play the sound from your local disk without attaching it to the swf, use .loadSound("the url", true);
Copy link to clipboard
Copied
Hey thnx Ron.
but am sorry it didnt work.you need some more details?I apply it on button(slow),but then its not going ahade after click on it.
the button has link which goes to new scene which has volume slider(it has to be adjust as per client's use slow,medium or high pitch.)this slider is continue on second,third to fifth scene.attached sound to button should play till this last scene.I'll try to put screenshots here for refrance.Sound should play after click on button.And that should not loop.It should play continue as a single.
Thnx a lot for reply!
Copy link to clipboard
Copied
here's a quick sample. Click here to download.
Copy link to clipboard
Copied
hey its working perfectlt. Thnx a lot.
can u help me some more about volume slider.(to reduce or incrise pitch of sound).
And currently (mySoundC.start(0,50);) this code loops sound.and i want to play it once.And if i go back then sound play continusly.which is no need to play for back btn.
download link doesnt open.
Thnx
Copy link to clipboard
Copied
mySoundC.start(0,0);
If you've got the answer to the question, close this thread (Answered). Open a new one for your volume slider question.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now