Copy link to clipboard
Copied
Hi All,
I am facing with some basic issue by mouse over and out event on my animaton. Here I have added my work files: https://www.dropbox.com/sh/t4x5dejodjwrhfj/AADPc2X1ShsIL27jls7JByFha?dl=0
My issue is that "mouse over" and "mouse out" script work more than one altgouh the crusor doesn't leave composition.
When I move crusor a little bit on the composition, out and over scripts were triggerred again and again.
Is there anyone who faced same issue and solved it?
Copy link to clipboard
Copied
Hi.
It's because the shape of your animation changes in each frame which affects the mouse cursor hit detection. You need to place a fixed round shape on top of everything (for example a Button instance with a circle in the hit frame).
Also, it seems to me you don't need a main timeline with more than one frame. But if you really need more frames, make sure to run a check so you won't add the same type of listener to the same instance multiple times. Like this:
if (_this.frame0Started)
{
_this.yourInstance.on("click", _this.yourEventHandler);
_this.frame0Started = true;
}
I hope this helps.
Regards,
JC