views:

42

answers:

2

Hello,

I'm looking for a way to increase the click size so when I click, it would effectively count as a click on anything that is in a 100px by 100px radius around the click.

Any help would be great, I couldn't find anything online for this.

Thanks a lot!

+1  A: 

The easiest way is to make use of the hitTest() method in flash. You can find more about it here

First, create a 100px * 100px Sprite instance, and make it invisible (alpha = 0). Then, attach it on the mouse's cursor. Next, add event listener on it for any collision detected during mouse clicking.

Yman
Apparently, hit testing in AS3 is done using the bounding boxes of the movie clip. Thus, a circular sprite with a radius of 100px will be treated as a 200x200px rectangle. So it won't quite achieve what he wants.
kaloyan
+2  A: 

What I would do is add a transparent sprite to each of the clickable objects and extend it out a 100px. Or, if you are using a button object, just make the hit area bigger.

If that doesn't work for you, you can try listening for MouseEvent.CLICK, getting the mouse coords at the time of the event and seeing if they are close to anything of interest. Probably sounds simpler than it really is, as the math will be hairy if you want it done properly.

kaloyan
+1 This is definitely the easy answer.
Ipsquiggle