Skip to main content
Participating Frequently
April 10, 2017
Answered

How to link to webpage from button click?

  • April 10, 2017
  • 2 replies
  • 7010 views

I keep getting syntax errors using the snippet code and I'm following the directions... Just want the button to link to an outside webpage - very new to Animate - and frustrated. Any suggestions much appreciated.

This topic has been closed for replies.
Correct answer kglad

that's html5 code.  if you're publishing for as3, using as3 code:

button_1.addEventListener(MouseEvent.CLICK,f1);

function f1(e:MouseEvent):void{

navigateToURL(new URLRequest('http://www.adobe.com'),'_blank');

}

2 replies

Participating Frequently
April 10, 2017

* 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 ("").

*/

this.button_1.addEventListener("click", fl_ClickToGoToWebPage_2);

function fl_ClickToGoToWebPage_2() {window.open("http://www.adobe.com","_blank")}

and error is

1120 Access of undefined property window

I replaced in my version the domain with the appropriate one - as instructions indicate to do

kglad
Braniac
April 10, 2017

what code you using that's triggering an error and what's the error?

Participating Frequently
April 10, 2017

Thanks for looking ...

I'm using this:

* 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 ("").

*/

this.button_1.addEventListener("click", fl_ClickToGoToWebPage_2);

function fl_ClickToGoToWebPage_2() {window.open("http://www.adobe.com","_blank")}

and error is

1120 Access of undefined property window

I replaced in my version the domain with the appropriate one - as instructions indicate to do

kglad
kgladCorrect answer
Braniac
April 10, 2017

that's html5 code.  if you're publishing for as3, using as3 code:

button_1.addEventListener(MouseEvent.CLICK,f1);

function f1(e:MouseEvent):void{

navigateToURL(new URLRequest('http://www.adobe.com'),'_blank');

}