Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Open to URL code snippet not working in browser?

$
0
0

Hi,

 

I have two buttons (actionscript3) that are meant to open URL's when clicked on. I used the code snippets to create this action (one opens URL in new browser, one plays music from URL). The buttons work fine when I test the project in Animate cc but once I test it in a browser the two buttons no longer open any URL. What could be going wrong?

 

Here's the code I used (from code snippets):

 

/* Click to Play/Stop Sound

Clicking on the symbol instance plays the specified sound.

Clicking on the symbol instance a second time stops the sound.

 

 

Instructions:

1. Replace "http://www.helpexamples.com/flash/sound/song1.mp3" below with the desired URL address of your sound file. Keep the quotation marks ("").

*/

 

 

music_btn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);

 

 

var fl_SC:SoundChannel;

 

 

//This variable keeps track of whether you want to play or stop the sound

var fl_ToPlay:Boolean = true;

 

 

function fl_ClickToPlayStopSound(evt:MouseEvent):void

{

  if(fl_ToPlay)

  {

  var s:Sound = new Sound(new URLRequest("http://www.helpexamples.com/flash/sound/song1.mp3"));

  fl_SC = s.play();

  }

  else

  {

  fl_SC.stop();

  }

  fl_ToPlay = !fl_ToPlay;

}

 

 

/* Click to Go to Web Page

Clicking on the specified symbol instance loads the URL in a new browser window.

 

 

Instructions:

1. Replace http://www.adobe.com with the desired URL address.

   Keep the quotation marks ("").

*/

 

 

url_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

 

 

function fl_ClickToGoToWebPage(event:MouseEvent):void

{

  navigateToURL(new URLRequest("http://www.gardeningchannel.com/25-fun-facts-about-flowers/"), "_blank");

}


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>