urlhtml5-canvasanimate-cc

Adobe Animate cc HTML 5 open URL


I load image into html 5 canvas in animate cc. I need to go to some URL's when I click some places in image. How to write code for open URL in new tab using Animate cc Actions panel.


Solution

  • You can use a premade snippet of code available in the code snippets panel. Firstly, create a movieclip on the stage and give it a name. Then with this object selected open the code snippets panel and choose HTML5 Canvas > Actions > Click to go to web page. This will produce a snippet like this in the actions panel:

    this.btn.addEventListener("click", fl_ClickToGoToWebPage);
    
    function fl_ClickToGoToWebPage() {
        window.open("http://www.adobe.com", "_blank");
    }
    

    Change "btn" to whatever you called your button and the url to your url of choice. Repeat as necessary with other buttons.