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

How to link to webpage from button click?

Community Beginner ,
Apr 10, 2017 Apr 10, 2017

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.

6.8K
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 , Apr 10, 2017 Apr 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');

}

Translate
Community Expert ,
Apr 10, 2017 Apr 10, 2017

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

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 Beginner ,
Apr 10, 2017 Apr 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

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 ,
Apr 10, 2017 Apr 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');

}

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 Beginner ,
Apr 10, 2017 Apr 10, 2017

Thank you VERY much. It works. 🙂

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 ,
Apr 10, 2017 Apr 10, 2017
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
Community Beginner ,
Apr 10, 2017 Apr 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

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