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

Having Trouble with Buttons That Link To Webpages

Community Beginner ,
Apr 09, 2018 Apr 09, 2018

Hi everyone,

I recently used Adobe Animate to make a moving image for the home page of my website. I run Adobe Animate Version 18.0 (Build 107) on a Windows 8.1 Laptop. Unfortunately, I've run into a few problems after exporting to SWF:

The links for "comics", "illustration", and "design" are not working. Whenever I test the movie in Adobe Animate, the links work just fine. But on my site, the buttons hover and click correctly, but do not carry to the links.

It's important to mention that after completing the swf, I placed it inside of an Adobe Muse document and converted it to wordpress through an FTP client (version 2018.0.0.685, CL 806425). Though, I don't think the error was necessarily caused by Muse -- see below.

Each of these buttons has a version of this code in the Action panel on Frame 1 under Scene 1:

Button code

var _this = this;

/*

Clicking on the specified symbol instance executes a function.

*/

_this.button_3.on('click', function(){

/*

Loads the URL in a new browser window.

*/

window.open('http://www.nutmegnautilus.com/design', '_blank');

});

I am unable to open just the SWF to see if it's an issue when exporting, but I know I get these errors when I publish as a movie. I tried to look up the error codes online, but couldn't find much:

I'm thinking I've put the code in the wrong spot, but I can't be sure as this is my first foray into Adobe Animate. All the links are within my current site, and there's a nav bar above, but it'd be nice to get these flash links working too.

Thank you in advance.

372
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 09, 2018 Apr 09, 2018

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

should be:

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

Translate
Community Expert ,
Apr 09, 2018 Apr 09, 2018

that's not actionscript.  it's javascript/easeljs.  you would publish an html5/canvas project with that code.

so either the code is wrong or you discussion of a swf is unrelated to the problem and you just need to upload the graphics etc folders published by your html5/canvas project.

from the error messages, it looks like you are publishing an as3 project (that may include a swf) and you're failing to use as3 code.  as3 would look like:

button_3.addEventListener(MouseEvent.CLICK,openF);

function openF(e:MouseEvent):void{

navigateToURL(new URLRequest(('http://www.nutmegnautilus.com/design'), '_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 09, 2018 Apr 09, 2018

Oh, ok, thank you. I don't know much about all the code stuff that goes into Adobe Animate documents.

I went ahead and put in the code, but when I try to export now, it gives me this error instead. I tried adding a right parenthesis in a few places but it didn't seem to work.

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 09, 2018 Apr 09, 2018

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

should be:

navigateToURL(new URLRequest('http://www.nutmegnautilus.com/design'), '_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 09, 2018 Apr 09, 2018

Thank you. Fixed the code and put into site, unfortunately getting these errors, and links still aren't going.

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, 2018 Apr 10, 2018

you have two (or more functions) with the same name.  fix that.

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, 2018 Apr 10, 2018

Oh, I see!! All my functions were named with the letter F. I fixed it. Links working well. Thank you so much.

The only thing I can think is, is there another form of the code that opens them in the same tab, rather than opening a new tab? But it works well as it is, so I don't mind.

Thank you again.

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, 2018 Apr 10, 2018
LATEST

yes.  use:  navigateToURL(new URLRequest('http://www.nutmegnautilus.com/design'), '_self');

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