Nathan
Nathan

Reputation: 81

Incrase click radius/size

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!

Upvotes: 1

Views: 713

Answers (2)

ktdrv
ktdrv

Reputation: 3673

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.

Upvotes: 2

Yman
Yman

Reputation: 934

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.

Upvotes: 1

Related Questions