Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound ON/Off

Status
Not open for further replies.

webkadi

Programmer
Jul 30, 2000
1
US
I have an intro movie with 3 scenes.<br>Each scene has his own soundtrack.<br>Each sound track contain 2-3 sounds.<br><br>1.How can I turn Off the sound of the entire movie, at any time.<br>2. How can I turn On the sound, and have exactly the sound which belongs to the scene that is playing<br><br>
 
The best way to do this is to create movie clips for each sound. That way you can control them with actionscripting. To do this :<br><br>- INSERT/NEW SYMBOL, name it Sound1 (or whatever you want)and create it as Movie Clip. <br><br>- Go to the first frame and double click on it to open the Properties window. In the Sound tab (I assume that you already imported the sounds) select the sound from the pop up menu and set up the properties. Effect: whatever you want. Sync: Stream so you can control it.&nbsp;&nbsp;Loop: depends on your sound. OK.<br><br>Now that you added the sound to the first frame, add frames along the movie clip until the number of frames in the movieclip approximately equals the number of frames in the sound. So maybe you will select frame 65 and right click/ ADD FRAME (Not Keyframe) if your sound is 65 frames long.<br><br>Now go to the Definition tab and name the instance. In this example, Sound1. ok and out.<br>&nbsp;<br>Do the same with all your sounds. <br><br>Now your sounds are in movie clips. Go back to your scenes and insert the sounds that you want wherever you want them but in a separate layer, adding regular frames after you insert the sound depending on the length, like you did before in the clip. <br><br>Now it comes the hard part. When the user clicks OFF, your sounds stop. So you can use STOP ALL SOUNDS, no problem because your sounds are streamed.&nbsp;&nbsp;But to go back when they click on is a little bit harder and I hope you get the explanation.<br><br>When the user clicks ON, you need to get the _currentframe and know the initial frame of the movie. The first part is easy, the second part is done by setting variables. You have to add actions to the first frame of each sound. Let us say that your Sound1 (now a movieclip) was inserted in the frame 5 Scene 2, that is where it starts. OK, so you go to the 5th frame in scene 2 and doubleclick on it, in the Properties/Actions tab, add a Set Variable(&quot;inisound1&quot;,_currentframe); make sure there is an equal sign in the button by the value box (not an abc)<br><br>Do the same with all your sounds, obviously changing inisoundX where X is the number you have been assigning to the sounds. <br><br>OK, we are almost done. Now you have to change the actions for the ON button depending on the sound that is playing. This means that if you are in scene 2 frame 5 and Sound3 is playing, the actions for ON are different than in frame 5 scene 1 when Sound1 is playing. So we are going to edit the ON button depending on the sound that is playing. Back to my example. We have a clip Sound1 at _level0 and an ON button that activates the sound. Suppose we are in frame 11 when the user clicks. Right there we collect the info for the _currentframe with:<br><br>On (Release)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set Variable(&quot;endSound1&quot;,_currentframe)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set Variable(&quot;realSound1&quot;,endSound1 - inisound1)<br>End On<br><br>Again make sure there is an equal sign on the button when you give the value to the variable.<br>Now we have the current frame(11) and the initial frame for sound1, which is the variable inisound1(5) So we have to substract current - ini and we get the exact frame (realSound1) that should be playing in the sound.(the movieclip Sound1).<br><br>Now simply add:<br><br>Begin Tell Target (&quot;_level0/Sound1&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Go to and Play (realSound1)<br>End Tell Target<br><br><br>The Go to and Play is assigned to an expression: realSound1.<br>So all the actions for the ON button when sound1 is playing are:<br><br>On (Release)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set Variable(&quot;endSound1&quot;,_currentframe)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set Variable(&quot;realSound1&quot;,endSound1 - inisound1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Begin Tell Target (&quot;_level0/Sound1&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Go to and Play (realSound1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End Tell Target<br>End On<br><br>Now just do the same with all your ON buttons when the other sounds are playing. <br><br>I hope you get this but if you need more help, write me.<br><br> <p>Fernando Regueiro<br><a href=mailto:ferhelping@yahoo.com>ferhelping@yahoo.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top