Creating Sound Control

This tutorial requires a basic knowledge of Flash. You must know how to create buttons, and work with Frames and Layers.

For this tutorial, you will need a sound loop - you can find plenty all over then net, or do what I did and create your own. I just tossed a very quick and easy loop into this tutorial.

Start a new Flash Document and add two layers. Name them as follows:

Actions & Controls

image 1

Import your sound file (Control + R - Choose Loop).

Open the Actions Box (F2).

Click to enlarge
Click to enlarge

Put in these Commands on the first frame of the Actions layer.

stop();

And, on the second frame of the Actions layer put in these commands:

stop();
stopAllSounds();

Now, click on Frame one of the Actions layer and press Control + F3 to open your Properties toolbox. In the sound dropbox, select your loop as the Sound.

Click to enlarge
Click to enlarge

We won't be adding any effects to the sound for this tutorial, but you can play with them later on. Set the loop to 100, or a number that you think will suffice for your Flash File.

Test the movie, if you hear the sound looping continuously, we can move on to the next step.

Create two separate buttons, one for Stop and one for Start. There will be no need to add any special Action Scripting for this, just the standard Go To and Play commands.

In the Control Layer, place your buttons in frame one. Now, Insert a KeyFrame on frame two, creating a duplicate of the first frame - this allows for a seamless transition from Frame 1 to Frame 2.

Click the first frame of the Actions Layer, and we will start to add the actions to the buttons.

In the first frame, only the Stop button needs to be active. I usually just select the Start button and hit Control + B to break it apart.

Select the Stop button and press F2, opening your Action Toolbox. Insert this command:

   on (release) {
    gotoAndPlay(2);
   }

Now, click on the second from on the Actions layer. I suggest, once again, that you disable the Stop button in this Frame.

Select the Start button, and add these commands:

   on (release) {
    gotoAndPlay(1);
   }

Now, we have total control over our sound.

Test the movie, Control + Enter, and see if you are able to Stop them on command, and Restart.


Close    To Top
  • Prev Article-Flash:
  • Next Article-Flash:
  • Now: Tutorial for Web and Software Design > Flash > Basic > Flash Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction