Expand the idea of Jason and draw an invisible rectangle "under" your
specific line. Assumed your line should be 30px long and your click radius
should be 5xp

var line:Sprite = new Sprite();
var g:Graphics = line.graphics;
g.clear();
// hit radius
*g.beginFill(0xff0000,0);*
g.drawRect(0,-3,30,5);
g.endFill();
// line itself
*g.beginFill(0x000000,1);
g.drawRect(0,0,30,1);*
g.endFill();

Notice that the hit radius has an alpha of zero and
the line an alpha of 1. Does it work for you?


Weyert de Boer schrieb:
Merrill, Jason wrote:
A simple solution could be to create a sprite to draw the line onto, and
add a listener to the sprite to see if it was clicked on.
Yes, but then you still have the problem that a two pixel line is not a great hit area for drawn line. That's why I asked the question to improve the experience by calculating the hit area myself. I can basically check if the click is within the given radius of the line.
If so, recognize the click as clicked on the line.


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to