开发者

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!


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜