Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Sound ON/Off

Sound ON/Off

Sound ON/Off

I have an intro movie with 3 scenes.
Each scene has his own soundtrack.
Each sound track contain 2-3 sounds.

1.How can I turn Off the sound of the entire movie, at any time.
2. How can I turn On the sound, and have exactly the sound which belongs to the scene that is playing

RE: Sound ON/Off

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 :

- INSERT/NEW SYMBOL, name it Sound1 (or whatever you want)and create it as Movie Clip.

- 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.  Loop: depends on your sound. OK.

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.

Now go to the Definition tab and name the instance. In this example, Sound1. ok and out.
Do the same with all your sounds.

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.

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.  But to go back when they click on is a little bit harder and I hope you get the explanation.

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("inisound1",_currentframe); make sure there is an equal sign in the button by the value box (not an abc)

Do the same with all your sounds, obviously changing inisoundX where X is the number you have been assigning to the sounds.

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:

On (Release)
     Set Variable("endSound1",_currentframe)
     Set Variable("realSound1",endSound1 - inisound1)
End On

Again make sure there is an equal sign on the button when you give the value to the variable.
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).

Now simply add:

Begin Tell Target ("_level0/Sound1")
      Go to and Play (realSound1)
End Tell Target

The Go to and Play is assigned to an expression: realSound1.
So all the actions for the ON button when sound1 is playing are:

On (Release)
     Set Variable("endSound1",_currentframe)
     Set Variable("realSound1",endSound1 - inisound1)
     Begin Tell Target ("_level0/Sound1")
         Go to and Play (realSound1)
     End Tell Target
End On

Now just do the same with all your ON buttons when the other sounds are playing.

I hope you get this but if you need more help, write me.

Fernando Regueiro

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close