Mouseover event specific to button area only
- August 26, 2021
- 1 reply
- 712 views
👋 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!
