问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/46609874/adobe-animate-cc-html-5-open-url