0

Can anyone help me I cant seem to get my play/stop button to stop and play my background music.
i imported my sound to my library and created the button to play and stop the sound but it doesnt work
what is the easiest way to do this in action script 3.0?
i tried uploading my file but i cant

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by dnmoore
0

This might work.

  1. Name your sound file mix1 in the Linkage menu, and select the "Export for Actionscript" and "Export in first frame" options
  2. Make 3 consecutive key frames in the movie timeline
  3. Make your play button the second frame (label as "play"), and make your stop button the last frame (label as "stop")

Paste

my_sound = new Sound();
my_sound.attachSound("mix1");
play();

into the actions panel for the first key frame. Give the stop() action to the second and third key frames. Paste

on (release) {
_root.my_sound.start(0,1000);
_root.gotoAndStop("stop");
}

into the actions panel for the play button in the second key frame. Finally, paste

on (release) {
_root.my_sound.stop();
_root.gotoAndStop("play");
}

into the actions panel for the stop button in the third key frame.

If you want to start with the bg music already playing, use the following code for the first key frame instead of the code I gave at the beginning:

my_sound = new Sound();
my_sound.attachSound("mix1");
my_sound.start(0,1000);
gotoAndStop("stop");

That should work. Cheers!

0

This might work.

  1. Name your sound file mix1 in the Linkage menu, and select the "Export for Actionscript" and "Export in first frame" options
  2. Make 3 consecutive key frames in the movie timeline
  3. Make your play button the second frame (label as "play"), and make your stop button the last frame (label as "stop")

Paste

my_sound = new Sound();
my_sound.attachSound("mix1");
play();

into the actions panel for the first key frame. Give the stop() action to the second and third key frames. Paste

on (release) {
_root.my_sound.start(0,1000);
_root.gotoAndStop("stop");
}

into the actions panel for the play button in the second key frame. Finally, paste

on (release) {
_root.my_sound.stop();
_root.gotoAndStop("play");
}

into the actions panel for the stop button in the third key frame.

If you want to start with the bg music already playing, use the following code for the first key frame instead of the code I gave at the beginning:

my_sound = new Sound();
my_sound.attachSound("mix1");
my_sound.start(0,1000);
gotoAndStop("stop");

That should work. Cheers!

Thank you

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.