Question

i'm making an application that draws curves with as3 and i ant the curves to highlight when the mouse is over.

I managed to do it with mouseOver, but the interaction is not natural because you have to be exactly on the curve (1px wide) to highlight it. So i was wondering if it was possible to have some sort of 'tolerance' on the mouseOver behaviour.

I know i could use a enterFrame event and check there the distance between the curve and the cursor, but it seems to me it will be a lot of calculations for such a simple task.

thanks.

ps: my curves are not real curves (like bezier), but a succession of lineTo commands.

Was it helpful?

Solution

There is no tolerance in mouse_over, so the quickest solution that I can imagine is to draw thicker line with alpha set to 0, and then addEventListener to that thicker invisible line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top