954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Flash

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

dnmoore
Light Poster
38 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This might work.Name your sound file mix1 in the Linkage menu, and select the "Export for Actionscript" and "Export in first frame" options
Make 3 consecutive key frames in the movie timeline
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!

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 
This might work.
  • Name your sound file mix1 in the Linkage menu, and select the "Export for Actionscript" and "Export in first frame" options
  • Make 3 consecutive key frames in the movie timeline
  • 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

dnmoore
Light Poster
38 posts since Sep 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: