AS3: custom cursor vs. custom context menu issues, another solution

As far as I know, the incorrect handling of the right click on a ‘mouseenabled = false’ movieclip is a known bug with few available workarounds. At least, it puzzled me for several hours.

The problem
A custom curser which covers the mouseX and mouseY (or 0;0) coordinates and has his mouseenabled = false (that’s what is neccessary to have any interaction in the movie) leads to the problem that, when a right click happens, the context menu of the stage is shown rather than the custom menu of the clicked movieclip.

I tested it and found, that by either setting the cursor’s mouseenabled to true or not adding it lead to correct behaviour. But that was not what I wanted.

My solution
So, what I did was rather simple. In the movieclip that serves as custom cursor, I just erased the one pixel (yeah, maybe two or three of his neighbors too) that represents the 0;0 or mouseX and mouseY.

And that did it. You won’t run into that problem with a hollow crosshair, but maybe you created an arrow cursor or a hand cursor that when on MOUSE.DOWN closes to a fist or something similar.

The small defect here is that one can see the background through this cursor hole. For today, I won’t care about this.

*show examples here tomorrow*

Ready, aim and grab ye menu. Yo ho!

This entry was posted in game development and tagged , , , , , . Bookmark the permalink.

Comments are closed.