?
Solved

very EASY question....sound buttons

Posted on 2003-03-21
14
Medium Priority
?
144 Views
Last Modified: 2010-04-03
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
Comment
Question by:plee142
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
14 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 8183571
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 8183602
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
 
LVL 6

Expert Comment

by:henryww
ID: 8183910
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
Independent Software Vendors: 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!

 

Author Comment

by:plee142
ID: 8183980
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
 

Author Comment

by:plee142
ID: 8184081
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
 

Author Comment

by:plee142
ID: 8184409
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 8184445
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
 

Author Comment

by:plee142
ID: 8184583
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
 
LVL 6

Expert Comment

by:henryww
ID: 8185651
i guess u are right rp ...
i don't even remmeber how to do it in the beginners way sometimes ... !!!

cheers
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 400 total points
ID: 8197450
"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
 

Author Comment

by:plee142
ID: 8197535
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
 

Author Comment

by:plee142
ID: 8197539
i guess i cant decrease points.  oh well then.  here's 100.

have a good one.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8197655
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
 

Author Comment

by:plee142
ID: 8197730
i have class tonight, so i'll give it a try tomorrow or so.
thanks again.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question