Flex detect when mouse leaves a Canvas
I am trying to detect when the mouse leaves a canvas. I know about the MOUSE_LEAVE, but this seems to only be valid for the stage, not Canvas objects.
take care, lee
P.S. I have tried the mous-out, bu开发者_开发知识库t, for some reason, that event keeps getting triggered everytime I move the mouse.
I should probably point out that I have used the Mouse.hide() and replaced the cursor with a custom cursor.
You could use either the MouseEvent.ROLL_OUT
event or MouseEvent.MOUSE_OUT
.
To see what is the difference and what you should use, read this article.
Try to use mouseOut
event.
Thanks everyone. The trick was to set the custom cursor's parent to mouseChildren = false. Not a practical solution for most situations, but good for this.
The problem was coming from the fact that the mouse is still on the stage and moves slightly faster than the code move the custom mouse. So if the mouse was moved too quickly, it actually moved off the custom cursor.
take care, lee
精彩评论