Monday 15 September 2014

lua - Touch Event detection issue -


When you add an event listener to an object and that object event.phase == "end" will not trigger because it is detected outside of the object. My question: There is no way that we can detect event.phase == "end" , even if the user contacts outside of the object Or if there is any other way, we can find out that the user uses his runtime event listener Without finger made?

You can try the following method:

  local bg = Display.newRect (0,0, display contentWidth, display.contentHeight) Local Rect = display.newRect (100,200,100,100) rect: setFillColor (0) local isRectTouched = false; Local function bgTouch_function (e) if (isRectTouched == true and e.phase == "end") is = pure; Print ("Started and ended on Rectum") End of BG: addEventListener ("touch", bgTouch_function) local function rectTouch_function (e) if (e.phase == "start" or e.phase == "moved ") Then IsRectTouched = true; Print ("Started / moved .... rect") and is; Print ("Ended .... Rect") and End: UndoAstAlastist ("Touch", Next Touch_Function)   

Keep coding ... .... ð ??????

No comments:

Post a Comment