Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

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
0
plee142
Asked:
plee142
  • 7
  • 5
  • 2
1 Solution
 
rascalpantsCommented:
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
0
 
rascalpantsCommented:
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
0
 
henrywwCommented:
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...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
plee142Author Commented:
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 :)
0
 
plee142Author Commented:
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 :)
0
 
plee142Author Commented:
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... :(
0
 
rascalpantsCommented:
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
0
 
plee142Author Commented:
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.
0
 
henrywwCommented:
i guess u are right rp ...
i don't even remmeber how to do it in the beginners way sometimes ... !!!

cheers
0
 
rascalpantsCommented:
"when publish previewing, all the buttons play their sounds at the same time.  the off button works.  i think i'm almost there."

plee,

you have to make sure that you are putting each soundclip in its own frame and a stop action has to be in that frame in a layer.

and you need to make sure that your sounds are not overlapping in any frames...

take a look at your timeline in flash and if there are any layers that have frames the extend into other frames, then you need to fix that...

and make sure that a stop(); action is in every frame... and also make sure you have labeled the frames correctly.


since you are a beginner to this stuff, I would recommend going through your file very carefully to make use that what I have mentioned above is done correctly...


rp
0
 
plee142Author Commented:
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.

0
 
plee142Author Commented:
i guess i cant decrease points.  oh well then.  here's 100.

have a good one.
0
 
rascalpantsCommented:
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
0
 
plee142Author Commented:
i have class tonight, so i'll give it a try tomorrow or so.
thanks again.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 7
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now