onTouch quicky question

Guys/Gals:

I am nearly done with my game, but when I uploaded it on to my Droid to test, although functionally everything works, its very hard to get the exact “click” on an object to internally generate an ‘onTouch’ event.

How can I or what is the technique to allow a bigger area to exist for an object to be able to click on it? In other words, my current object is a narrow rectangle and I need to click on its ends…how can I make the system be ‘forgiving’ so that the user can click a bit outside the ends of the rectangle and still have it generate onTouch?

Thanks to all for excellent support in the past.

Oleg
[import]uid: 92927 topic_id: 19326 reply_id: 319326[/import]

Could you just create another rectangle for the touch event area that you want?

Then use the properties object.isVisible=false and object.isHitTestable=true . [import]uid: 94868 topic_id: 19326 reply_id: 74561[/import]

Thanks Screaming Leaf,

That’s a very interesting idea…I do have a lot of these rectangles floating around, so I would need a fairly close tracking of these invisible hit area objects as well… a bit complicated… Is there anything easier I can do? What is the ‘mask’ capability for, can that somehow be used for this purpose?

Thanks,
Oleg
[import]uid: 92927 topic_id: 19326 reply_id: 74563[/import]

…also…forgot to ask…if I was to use your idea and captured the onTouch outside the visible rectangle and inside the ‘hidden rectangle’ is there a way I can manually force the onTouch to occur for my (visible) rectangle so that the existing code will run as is?

Thanks,
Oleg
[import]uid: 92927 topic_id: 19326 reply_id: 74566[/import]

For easier organization, you could try putting them in groups. Put the visible and invisible object in the same group. And now when you want to manipulate or reference the group, both items should be affected.

You would have to change the listener to the invisible object, since that is what you want to register the touch event. And if you are not using an event.target reference in your event listener, I would think your code would remain the same.

Masking is for when you want to make certain parts of display object invisible. [import]uid: 94868 topic_id: 19326 reply_id: 74568[/import]

Is there a way to ‘force’ the onTouch event to occur for the visible rectangle? That is, in the onTouch of the invisible one, can I force the original onTouch to run? [import]uid: 92927 topic_id: 19326 reply_id: 74570[/import]

You could use physics editor. Physics editor allows you to change the scale of the physic bodies. Therefore allowing you to have more of a touch area. Just an option, but it does help me.

Website link: http://www.physicseditor.de/ [import]uid: 23689 topic_id: 19326 reply_id: 74575[/import]