touch event on a display object and screen

Hi,

I want to distinguish between touch event on a display object and other areas of the screen. What I want to do is having two display objects called A and B. If I touch on A, it will be removed and B doesn't jump. If I touch on B or other area of the screen then I'd like to make B jump. I try to use Runtime but it also detect the event when I click on A(no doubt since its global).

Hope someone can share me the code. Thanks.

Steve

Rather than using runtime add an event listener to the object to run the different functions?

I can add to B but how to touch anywhere on the screen to make B jump?

Steve

There are several ways to do that,

1. have three objects, A, B and a rectangle with 0.1 opacity which is nearly invisible, but will capture all events. So you can handle which object was touched. eliminating the need for runtime eventHandler

2. have a runtime handler, but then return true to indicate that you have handled the touches somewhere.

I guess this should get you going,

cheers,

?:)

That works. Thank you.

Steve

views:1230 update:2011/9/27 8:54:05
corona forums © 2003-2011