2012-09-12 47 views
0

在我的應用我想,當我觸摸其中要涉及到一些地區的形象來算touches.but則只能算將increse.plese幫我如何檢測電暈sdk中的觸摸區域?

function pop(event) 

    if event.phase=="began" then 

    elseif event.phase == "ended" then 

    numValue=numValue+1 
    print("tapcount value"..numValue) 
    count.text=numValue 
    end 
end 
lips:addEventListener("touch",pop) 
+0

plz給一些建議。可能與否 – Malar

回答

0

這是你在找什麼..?

local obj_1 = ..... ; obj.tag = 1 
local lips = ..... ; lips.tag = 2 
local count = ..... 

local numValue = 0 
local clickedObj_tag = 0 

    local function pop(e) 
     if(clickedObj_tag~=e.target.tag)then 
     clickedObj_tag = e.target.tag 
     -- cover/highlight your object 
    else 
     numValue=numValue+1 
     print("tapcount value"..numValue) 
     count.text=numValue 
     -- do rest of your code 
    end 
    lips:addEventListener("touch",pop) 
    obj_1:addEventListener("touch",pop)