Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get the Play Music Button to work in a Published .swf file?

New Here ,
Jun 19, 2019 Jun 19, 2019

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();

}

680
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 20, 2019 Jun 20, 2019

no code will execute in those programs.

what are your plans for your project?

Translate
Community Expert ,
Jun 20, 2019 Jun 20, 2019

with that code, your mp3 needs to be in the same directory as your swf.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

The mp3 is in the same folder.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

then your code is correct.  there must be something else making you think there's a problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

Well when I watch the Published .swf file the play music button does not work. I was using adobe acrobat DC to open the .swf

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

there's something on your computer causing the perceived problem  what's your computer's flash player version?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

in adobe animate in publish setting it said Flash Player 30.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

and when I go into control panel in Flash under updates it said NPAPI Plug-inVersion: 32.0.0.207

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

when you click your swf, it should open in your os flash player (if you have one).  or does it open in your browser?

if it opens in your browser, it's a browser issue/setting.  if it opens in your os player, you'll see something like:

Screenshot - 6_20_2019 , 9_10_48 AM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

Mine opens in windows Media player. And then said: "Your current security settings do not allow this action". So I set mine to open in Adobe Acrobat.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

no code will execute in those programs.

what are your plans for your project?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 20, 2019 Jun 20, 2019

I am just making this project for fun, and to see what I can do in adobe animate.

Thank you very much for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019
LATEST

you’re welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines