Highlighted

html5 banners add addEventListener to create rollover states of MovieClip

Explorer ,
Feb 19, 2019

Copy link to clipboard

Copied

I am creating HTML5 banners in Adobe Animate CC (HTML Canvas). But I have never found an answer to this question. If I want a visual MovieClip to change on rollover thats easy using a instance of a button or event a movieClip using an "addEventListener".

The problem coming when the animation is turned into a banner for DoubleClick Manger/Studio etc we have to add a "a href" around the div = "animation_container" inside the body tag... this then takes the focus away from the rollover of the MC!!!

I found a way to trigger this event on rollover of the whole canvas tag see below - but is there away to only trigger this on rollover/out of the movieClip only?

canvas.addEventListener("mouseover", over.bind(this));

function over()

{

this.btn.gotoAndPlay("over_start");

}

canvas.addEventListener("mouseout", out.bind(this));

function out()

{

this.btn.gotoAndPlay("out_start");

}

TOPICS
Discussions

Views

434

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

html5 banners add addEventListener to create rollover states of MovieClip

Explorer ,
Feb 19, 2019

Copy link to clipboard

Copied

I am creating HTML5 banners in Adobe Animate CC (HTML Canvas). But I have never found an answer to this question. If I want a visual MovieClip to change on rollover thats easy using a instance of a button or event a movieClip using an "addEventListener".

The problem coming when the animation is turned into a banner for DoubleClick Manger/Studio etc we have to add a "a href" around the div = "animation_container" inside the body tag... this then takes the focus away from the rollover of the MC!!!

I found a way to trigger this event on rollover of the whole canvas tag see below - but is there away to only trigger this on rollover/out of the movieClip only?

canvas.addEventListener("mouseover", over.bind(this));

function over()

{

this.btn.gotoAndPlay("over_start");

}

canvas.addEventListener("mouseout", out.bind(this));

function out()

{

this.btn.gotoAndPlay("out_start");

}

TOPICS
Discussions

Views

435

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 19, 2019 0
Enthusiast ,
Feb 19, 2019

Copy link to clipboard

Copied

Give your movie clip a label of btn on any keyframe it exists on.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2019 1
Explorer ,
Feb 19, 2019

Copy link to clipboard

Copied

Thats doesn't work.. it already has label of btn.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2019 0