PDA

View Full Version : Music On/Off Button.


Dragon
12-01-2007, 07:38 PM
I need a tut that can explain how to make a Play/Pause button in my movie for music..

Or could someone here explain, that would be better..?

Lui
12-03-2007, 01:30 AM
Try searching the forum, your bound to find something.

Matt
12-03-2007, 05:15 AM
Basically just make a movieclip, on it's first frame Inside on (it's timeline) have it say "Music:On" and put the music onto that frame. Then on the second frame of it put "Music:Off" and on the timeline put
stopAllSounds()
On the main (_root) timeline put this code on the action panel
YourMCInstancename.onRelease=function(){
//change YourMCInstancename to the instance name of the on/off MC we made
this.play()
}

edit:
Tut version since you want it in a tut:
1) Write "Music:On" using the text tool
2) Convert to a MovieClip NOT a button, you can use MCs as buttons
3) Now double click on the MC
4) You'll notice the new timeline, it's inside that MC
5) Add your music to the first frame (file>insert>insert to stage>wav/mp3 file. Then on the frames properties panel select it in the drop down box)
6) Create a keyframe on the second frame
7) Change the text on the second frame to say "Music:Off"
8) Now on the second frame's action panel put "stopAllSounds()" without quotes.
9) No double click anywhere else to go to the main timeline
10) Give the MC we made the instancename of "music_but" without quotes
11) Now on the ROOT FRAME'S action panel put this
music_but.onRelease=function(){
this.play()
}

Aquamenti
12-03-2007, 05:21 AM
Look at the thread you posted in Spammer Land.

Matt
12-03-2007, 05:23 AM
Blaze was coding in AS1. I finished editing my post above with the tut.

truimagz
12-03-2007, 07:59 AM
you should be using a sound method.


Sound constructor
public Sound([target:Object])

Creates a new Sound object for a specified movie clip. If you do not specify a target instance, the Sound object controls all of the sounds in the movie.

Availability: ActionScript 1.0; Flash Player 5

Parameters
target:Object [optional] - The MovieClip or Button instance on which the Sound object operates.

Example
The following example creates a new Sound object called global_sound. The second line calls setVolume() and adjusts the volume on all sounds in the movie to 50%.

var global_sound:Sound = new Sound();

global_sound.onLoad = function(success:Boolean) {

if (success) {

global_sound.setVolume(50);
global_sound.start()

}

}

global_sound.loadSound("song1.mp3", true);