Sunday, September 28, 2008

(0) Comments

Sound On Off button in Flash

Rabin Biswas

,

  • Technorati
  • Del.icio.us
  •  DiggIt!
  •  Yahoo!
  •  Google
  • facebook

Sub - Sound On Off button in Macromedia Flash.
What we are going to make is this:



Requirments - Flash MX or Higher versions, with ActionScript 1/2/3.
Level - Basic ActionScript


Step 1 :- Create two buttons that are sort of similar and represent sound on and off.



 

Step 2 :- Import your sound file into your movie.



Step 3 :- Open your Library panel (Ctrl+L), locate and right click on your sound file. From the list select Linkage... or Properties... the linkage/properties form will pop-up. Then tick on the Export for ActionScript. A default name of your sound file will automatically appear in the Identifier box. and also check the Export in first frame box.(This allows your sound file to be called by actionscript)



Step 4 :- Paste this code on the first frame of your movie.

my_sound = new Sound();
my_sound.attachSound("The Crazy Frog India Remix.mp3");

(Sound attached)

Step 5 :- Now select the play button - and go to action script. Then paste the code bellow.

on (release) {
 _root.my_sound.start(0,1000);
}

(Sounds starts)

Spet 6 :- Paste this code for Stop button.

on (release) {
 stopAllSounds();
}

(Stops all sounds)

Now test your movie.

You will see that the buttons are working but there are some problems in the movie. Like if you press the play button twice/thrise the sound will play repetadely. And when you press the stop button all the sounds in your movie(if available) stops. So we need something else.


Related Posts :



0 Responses to "Sound On Off button in Flash"

Post a Comment