Canceling a touch event during certain conditions

Hi,

I’ve run into an issue where i need to cancel a touch event in the “moved” phase of a touch event, because it crashes due to a nil variable if the user started touching outside of my object, and drags his finger onto it.

Basicly what i want to do, is to do a check in the moved phase of the event, and if the variable is nil, cancel the event and do nothing.

Something like:

[lua]if object.startMoveX == NIL then
– cancel event, do nothing
else
– complete event correctly (this part works)

[/lua] 

Is there an easy way to achieve this?

Thanks

Thread can be closed.

Solved it by wrapping the event in the conditional check.

Thread can be closed.

Solved it by wrapping the event in the conditional check.