How to get the Play Music Button to work in a Published .swf file?
I am new to Adobe Animate and AS3. And I am trying to create a button that plays music in a .swf file. I have already created two buttons: one that stops my music. and one that plays it. The code I used is below. It works in the test in Animate but does not work in Published .swf file. I would appreciate if you could tell me how to get it to work for .swf file? The stop button works fine in .swf. Final question - is there a way to get buttons to work in a .GIF?
This is the code that I am using for my buttons to stop and play music:
var mySound:Sound = new Sound();
var myURL:URLRequest = new URLRequest("audio_hero_Separate-Ways_SIPML_C-1317.mp3");
mySound.load(myURL);
music_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, beQuiet);
function playSound(e:MouseEvent):void
{
mySound.play();
}
function beQuiet(e:MouseEvent):void
{
SoundMixer.stopAll();
}
