untouchable after touch

How do I make a rectangle untouchable until event.phase == “ended”.

Description:

There are two rectangles in the group. If there was a touch on the group, the group should be untouchable until the end the touch. With setting alpha 0 it is not working.

Code is below:

function touchListener(event)     if (event.phase == "began") then         --do something and then do untouchable rectGroup     elseif (event.phase == "ended") then         --do rectGroup visiable to touch     end end rectGroup = display.newGroup(); local rect1 = display.newRect(rectGroup, 0, 0, 74, 308); local rect2 = display.newRect(rectGroup, 0, 308, 97, 254); rectGroup:addEventListener("touch", touchListener);

Im not sure what you mean but try getting 

rectGroup:removeEventListener("touch", touchListener);

where/when you want it not to be touch able.?

–SonicX278

I would do:

event.target:removeEventListener("touch", touchListener);

That way if you have multiple objects that share the touchListener function, it will remove the one being touched.

Rob

I want to do group untouchable while user finger touching the group. And after touching the end make this group able to touch.

If I remove listener, then I can not listen phase “ended”.

So if one figer is touching another one can’t.

–SonicX278

it is possible when multitouch is active

Im not sure what you mean but try getting 

rectGroup:removeEventListener("touch", touchListener);

where/when you want it not to be touch able.?

–SonicX278

I would do:

event.target:removeEventListener("touch", touchListener);

That way if you have multiple objects that share the touchListener function, it will remove the one being touched.

Rob

I want to do group untouchable while user finger touching the group. And after touching the end make this group able to touch.

If I remove listener, then I can not listen phase “ended”.

So if one figer is touching another one can’t.

–SonicX278

it is possible when multitouch is active