Web Design Talks
website design tips and tricks

Button to Music Swith ON/OFF

June 22, 2008 21:54 by anjel

Create new clip for sounds:

  1. Create 3 main frames
  2. Add action stop() in every frame
  3. Insert music in the first frame
  4. Insert gotoAndStop(1);  in the second frame
  5. Insert gotoAndPlay(1);  in the third frame

Create Button:

  1. Create 2 main frames
  2. Add action stop() in every frame
  3. Insert OFF button in the first frame
  4. Insert actions in the OFF button:
  • on (release) {
    tellTarget ("../music") {
    stopAllSounds();
    }
    }
    on (release) {
    nextFrame();
    }

Insert ON button in the first frame and the action script:

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

Now place clip with music on the first scene and name it music in instance panel. 

Place the button on the main scene.

Press Ctrl+Enter


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts