Skip to main content
Known Participant
November 18, 2016
Answered

How do I add several links in one Canvas Adobe Animate

  • November 18, 2016
  • 2 replies
  • 1195 views

Hi,

I want to add two different links on a timeline. But when I have added two buttons with different links both of them opens the same link.

How do I fix this?

    This topic has been closed for replies.
    Correct answer rezun8

    give each button its own instance name, then use the code snippets window and add the script for each one. remember it will write the code on the main timeline and not on the object like in Flash.

    2 replies

    Known Participant
    November 18, 2016

    It works to add the snippets on just one place and to have two links in one canvas works.

    BUT, in Chrome, Firefox when I click on one of the buttons it opens the samel link in several tabs, all depending on how many times the canvas is being played in the original tab. I need to solve this, how do I do that?

    Colin Holgate
    Inspiring
    November 18, 2016

    The code snippet uses "_blank" as a parameter. If you want to replace the current window with the new web page, you could say "_self" instead. If you want to keep your page open but open the linked pages in the same new tab, make up another name for that parameter. Like: "_thisone".

    The tab that the browser considers to be "_thisone" won't exist on the first click, and so a tab will be opened. But after that the tab does exist, and its contents will be replaced.

    Known Participant
    November 18, 2016

    Yes that worked! Great!

    I notice that I can name the tab to basically anything.

    - Is there a html5 name that have the right syntax and should be used?

    - Will all web browsers behave the same like for example Safari and mobile browsers?

    rezun8
    rezun8Correct answer
    Inspiring
    November 18, 2016

    give each button its own instance name, then use the code snippets window and add the script for each one. remember it will write the code on the main timeline and not on the object like in Flash.

    Legend
    November 18, 2016

    Dumping event handler code directly on the object has been deprecated practice for years. It's not something new to Animate.

    Colin Holgate
    Inspiring
    November 18, 2016

    Or more exactly, it's an AS1/AS2 way of working, AS3 doesn't support it, and the last version of Flash Pro that supported AS2 was CS6.

    It was a useful way to work though, but had some drawbacks. For example, if you had 100 objects that needed the same routine, and you made an improvement, you would have to copy the improvement to the other 99 instances.

    You can put code in the timeline of movieclips, and then it does behave much like it used to with attached code. Plus, you only have to go to one place to update the code.

    But as rezun8 says, you can use the code snippets on different named instances, and each function will be added to the timeline.