Flash HTML5 canvas Clicktag

3.3k Views Asked by At

Looking for definitive instructions for clicktag setup in Adobe Flash (now Animate) using the HTML5 canvas?

My guess is -

Create a button. Give it a name. Create an scene action. And the code would be..?

Thanks :)

3

There are 3 best solutions below

0
On

You need to add an event listener for "click" to the button.

button.addEventListener("click", buttonClicked);
function buttonClicked() {
    alert("Clicked!");
}

See more here.

1
On

In the head of your html doc

<script type="text/javascript">var clickTag = "https://www.google.com";</script>

right before the ending > in your canvas div

onclick="javascript:window.open(window.clickTag)"

just having a button symbol in your canvas FLA gives you a cursor

0
On

thanks for these. I've found an answer that works best for me within Animate CC (Flash) -

  • Create a button, name it 'click' (for example)
  • Add the following code to Actions:

    this.click.addEventListener('mousedown',bF);
    function bF(e){
    window.open(clickTag, "_blank");
    }
    

Note to make the HTML code validate for ads, you need to add the following line to the meta tags (size adjusted) -

<meta name="ad.size" content="width=160,height=600">

And there cannot be links to outside URLs.