Link to home
Start Free TrialLog in
Avatar of plee142
plee142

asked on

very EASY question....sound buttons

hi there.  i want to create buttons to play various music on my website.
also an off button.

similiar to
http://www.ktinternational.com/rongai2.swf

i'm a beginner so please include specific steps.

thanks :)

trial flash mx 6.0
Avatar of rascalpants
rascalpants
Flag of United States of America image

that link did not load for me, so here is what you do to make a simple play and stop controller...

// create your buttons and put this on the play button:

on(release){
  _root.audio.gotoAndPlay("play");
}

// on the stop button put this code:


on(release){
  _root.audio.gotoAndPlay("stop");
  stopAllSounds();
}



next you make a movieclip with two frames and name if "audio"

in frame 1 you put a stop(); action and give it a label of "stop"

in frame 2 you put a stop(); action and give it a label of "play"

You then import the sound track you want, and select frame 2 and then select the sound track from the properties box.  You should select start as your sync type, so you don't ever duplicate the sound.



this is the most basic sound controller I can think of... if you need something fancier(like multiple audio tracks) let me know...


rp
with multiple tracks you can just make two more frames per sound in the audio movieclip, and then just do the same thing as I mentioned before...

you just need to give each frame label something unique so that the playhead knows where to go...


simple process...


rp
Avatar of henryww
henryww

hi ...

rp ... _root.audio.gotoAndPlay("stop"); stops the movieclip audio but will not stop the sound from playing..... !!!???

it will be easier to just use the sound object ...
just a suggestion...
Avatar of plee142

ASKER

if it wouldnt be too much trouble, could someone AIM or ICQ me.  i am a beginner with Flash, but i am computer literate.

AIM = plee142
ICQ = 166056717

thanks :)
Avatar of plee142

ASKER

if it wouldnt be too much trouble, could someone AIM or ICQ me.  i am a beginner with Flash, but i am computer literate.

AIM = plee142
ICQ = 166056717

thanks :)
Avatar of plee142

ASKER

ok. i imported all my mp3 files. then created a movie clip (Insert|New Symbol...) then i added text buttons onto the movie clip. i put all this on scene 1. so far i have everything on layer 1. then i clicked on actions for my first button and selected the onRelease (button) command. and this is what it tells me: <not set yet>.onRelease = function() {
    };

what do i put there <not set yet>?

am i doing this right?

confussed... :(
henry, look right below that part of the code:

stopAllSounds();

that stops all the sound...

I think you might be over complicating this one, because a beginner will have problems with the more advanced Actionscript code that you are talking about...


plee142,

to set actionscript to a button, you must click on the button symbol once, and open the actions panel...

then you type this:

on(release){
  _root.audio.gotoAndPlay("stop");
 stopAllSounds();
}

or

on(release){
  stopAllSounds();
  _root.audio.gotoAndPlay("track1");
}


you put the above code on each button and just change out the frame label which in this case is "track1"

so in a frame put the label "track1" and then put the sound in that frame using the properties box...


I will be away for the weekend, see you on Monday...


rp
Avatar of plee142

ASKER

ok. i out all my buttons directly on scence 1 because i couldnt add any actions to them while they were on the movie clip.

so anyway, to the music off button, i added:

on(release){
 _root.audio.gotoAndPlay("stop");
stopAllSounds();
}

and to other music buttons, i added:

on(release){
 stopAllSounds();
 _root.audio.gotoAndPlay("track1");
}

when publish previewing, all the buttons play their sounds at the same time.  the off button works.  i think i'm almost there.
i guess u are right rp ...
i don't even remmeber how to do it in the beginners way sometimes ... !!!

cheers
ASKER CERTIFIED SOLUTION
Avatar of rascalpants
rascalpants
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of plee142

ASKER

rp,

thanks for your efforts.  i'll give you half the points (50) for your efforts.  but i am still confussed.  i dont know what to put where (you say stop action in every frame, but where does that go?  action panel?  button properties?)

anyways, i dont wanna waste anymore of anyone's time.  i think i am too novice at this.

thanks again.

Avatar of plee142

ASKER

i guess i cant decrease points.  oh well then.  here's 100.

have a good one.
you are not wasting anyones time at all plee!  that is what this forum is all about...

when I say put a stop(); action on a frame, I mean you should click on the frame in the timeline and press the F9 key to open the Actions panel.

that is where you type in or select from the left the stop(); action.

when you want to make a button do something, you put the actionscript "on" the button... which means you click on the button and hit the F9 key.  the actions goes on the button...

here is a simple rule of thumb:

- if you want the movie itself to do something, put the actionscript in the timeline.

- if you want a button to do something, put the actionscript "on" the button itself.

to control movieclips you can put the actionscript in almost anywhere...

like if you wanted to have a movieclip with the instance name of ball, in the middle of your stage then you would put the below code on a Frame in the timeline.

_root.ball._x = 175;
_root.ball._y = 175;


this code would put the ball movieclip(50X50 in size) in the center of a movie that was 400 X 400 in size.

I would not want to accept your points, if you did not get what you wanted from all of this...


let me know if you have more questions...


rp
Avatar of plee142

ASKER

i have class tonight, so i'll give it a try tomorrow or so.
thanks again.