Flash Tutorials
& Resources
Dreamweaver
Tutorials
Fireworks Tutorials
& Resources
Photoshop
Tutorials
Web Design
Tutorials & Resources
CSS
Tutorials
CorelDraw
Tutorials
You are here : : zHome > Free Resources > Flash Tutorials & Resources > Sound On/Off Button   

Flash Sound On/Off Button

In this tutorial you will learn how to create a simple Flash music on and off button using Flash actionscript. Fla download is also included.

This tutorial starts with the music on. On clicking the button music goes off (as seen in the demo). You can start the music again at any point during the movie.

STEPS TO FOLLOW

To start with, make 2 buttons. 1 for ON and another, for OFF
Demonstration
Download the .fla

Next you need to create 2 Movie clips.
  • For sound
  • For buttons
Okay let's start with the Sound Movie clip
  • Create three keyframes.
  • Insert stop action to all the keyframes.
  • Insert your music into frame1.
  • NOTE: Keep the loop count of your music fairly an high value and the sync should be at event.

  • In frame2 insert the following code,

    gotoAndStop(1);

  • In frame3 insert the following code,

    gotoAndPlay(1);
Now you are through with your Sound Movie clip.

Next, Lets start with the Button Movie clip
  • Create 2 keyframes.
  • Insert stop actions to both the keyframes.
  • Insert OFF button into frame1.
  • Select your OFF button and insert the following code,

    on (release) {
    tellTarget ("../music") {
    stopAllSounds();
    }
    }
    on (release) {
    nextFrame();
    }

  • Insert ON button into frame2.
  • Select your ON button and insert the following code,

    on (release) {
    tellTarget ("../music") {
    nextFrame();
    }
    }
    on (release) {
    prevFrame();
    }
  • Insert your Sound Movie clip into your movie and name it "music" in your instance panel.
  • Insert your Button Movie clip into your movie.
  • Now press ctrl+enter to play your movie.


Download the .fla


Now building a website is as easy as 1-2-3!

Please Like, Tweet, Share or Comment on this page if you found this tutorial/resource useful!

Join us on Facebook to keep updated with all the latest tutorials and web design freebies from EntheosWeb!

No portion of these materials may be reproduced in any manner whatsoever, without the express written consent of Entheos. Any unauthorized use, sharing, reproduction or distribution of these materials by any means, electronic, mechanical, or otherwise is strictly prohibited.


Flash Website Templates

EntheosWeb Design Blog

Flash Photo Galleries

New Flash CS5 Tutorials

Page Roll Transition Effect

Outline Animation Effect in Flash

Creating a Rotating 3D Planet in Flash

Striped Transition Effect Tutorial in Flash

Burning Image Effect in Flash

Realistic Rippling Water Animation in Flash

New Flash Resources

Best 3D & Carousel Flash & XML Photo Galleries

Best Flash Animated Backgrounds

Best Flash Photo Gallery Website Templates

Best Heart Flash Animations

Featured Template
Template Number: 35418
Type: Joomla 1.7 Template
Price: $65