Mouseover event specific to button area only

New Here ,
Aug 26, 2021 Aug 26, 2021

Copy link to clipboard

Copied

👋 community,

 

I have an issue with a mouseover event and was hoping that someone clever on here could help. Here's what I'm trying to achieve.

There's a legal button on the banner that will open a legal tray on mouseover and reverse animation on mouse out.

Right now, the mouseover and mouseout event listener is active when the mouse hovers over an area directly to the left of the button and directly over the legal button. Is there a way to detect the mouseover and mouseout event only on the button area.

This is the code I'm using:

var root = this;
var disclaimer = this.btn_disclaimer;
var disclaimer_tray = this.legal_tray;
var disclaimer_bg = this.dimmer_mc;

stage.enableMouseOver(20);

disclaimer.addEventListener("mouseover", showDisclaimer.bind(this));
disclaimer.addEventListener("mouseout", hideDisclaimer.bind(this));
disclaimer.mouseChildren = false;

function showDisclaimer() {
disclaimer_tray.gotoAndPlay('startDisclaimer');
disclaimer_bg.gotoAndPlay('startDisclaimer');
}


function hideDisclaimer() {
disclaimer_tray.gotoAndPlay('hideDisclaimer');
disclaimer_bg.gotoAndPlay('hideDisclaimer');
}

Thanks for the help!

Views

61

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
community guidelines
Adobe Community Professional ,
Aug 27, 2021 Aug 27, 2021

Copy link to clipboard

Copied

you have all sorts of potential issues that can't be determined from what you've stated.  eg,

 

1. what's in the global code?  

2. what's the code on frame 29?

3. where are the this.stop()'s?

4. the code you showed is for mouse events on btn_disclaimer.  where/what's that and how's it related to "a legal button"?

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
community guidelines
New Here ,
Aug 27, 2021 Aug 27, 2021

Copy link to clipboard

Copied

Hi @kglad 

Here is a little more details.  Please see attached.  Thanks for your help.

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
community guidelines
Adobe Community Professional ,
Aug 27, 2021 Aug 27, 2021

Copy link to clipboard

Copied

LATEST

that is screwy.  you really show stop giving each object mulitple names.

 

anyway, remove that global script and put on the main timeline.

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
community guidelines