Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to attach sound to any button?which will continue that sound.

Guest
Aug 30, 2013 Aug 30, 2013

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.

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Aug 31, 2013 Aug 31, 2013

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.

Translate
Participant ,
Aug 30, 2013 Aug 30, 2013

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2013 Aug 30, 2013

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 30, 2013 Aug 30, 2013

here's a quick sample. Click here to download.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 30, 2013 Aug 30, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 31, 2013 Aug 31, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines