Hi,
first import you music to flash, then open the library. find the sound you just imported and right click on it, select linkage.
from the linkage dialog box choose export for actionscript and fill in the identifier field. click ok.
now you can add some frame actions to control the sound,
ActionScript Code:
mySound = new Sound(this);
mySound.attachSound("the_identifier_you_used");
mySound.start(0, 9999); // to begin have the sound playing, loop it 9999 times
// now an event handler for a button (with the instance name soundToggle_btn) to toggle the sound on and off
soundToggle_btn.onPress = function() {
this.count++; // add 1 to a variable this.count
if (this.count % 2) { // this.count is an odd number
mySound.stop(); // assuming the music is playing to begin on the first click stop it
} else { // this.count is even
mySound.start(0, 9999); // reststart it
}
};
Finally create the button and give it the instance name soundToggle_btn