Hello. n[count5]:removeEventListener(“touch”, sceneStart) works only for touched object (n[count5]) but not for the other. Any ideas?
function scene:show(event) if "did" == event.phase then for i = 1, #myData.type do if myData.category[i] == "category1" then count = count + 1 if myData.type[i] == "video" then video = video + 1 local function sceneStart(event) if "began" == event.phase then newVideo = native.newVideo(display.contentCenterX, display.contentCenterY, 1280, 720) newVideo:load("url"..event.target.name, media.RemoteSource) newVideo:addEventListener("video", videoListener) newVideo.id = i newVideo.count2 = count for q = 1, #myData.type do if myData.category[q] == "category1" then count5 = count5 + 1 n[count5]:removeEventListener("touch", sceneStart) end end return true end end n[count]:addEventListener("touch", sceneStart) n[count].name = "video"..video..".mp4" n[count].id = count elseif myData.type[i] == "image" then image = image + 1 local function sceneStart(event) if "began" == event.phase then display.loadRemoteImage("url"..event.target.name, "GET", networkListener, event.target.name, system.TemporaryDirectory, display.contentCenterX, display.contentCenterY) id = event.target.id for q = 1, #myData.type do if myData.category[q] == "category1" then count5 = count5 + 1 n[count5]:removeEventListener("touch", sceneStart) end end count5 = 0 return true end end n[count]:addEventListener("touch", sceneStart) n[count].name = "image"..image..".png" n[count].id = count end end end end end
