my code run smooth when I run in main file but when I make write this code in some other lua file and call that file with the help of director.lua, it doesnt recognized ended event phase on touching. Pls help me out.
Thanks in advance.
Here is my code.
function touched( event )
if event.phase == "ended" then
if(event.x - event.xStart > 30)then
sliding = true;
line = display.newLine(event.xStart, event.yStart, event.x, event.y)
line:setColor(255,0,0)
line.width = 5
else
print("just a touch")
end
end
end
Runtime:addEventListener("touch", touched , -1)
I just tested this using Director with a standard Director main.lua file and a scene1.lua file containing only your code from the above post and it worked just fine.
You could provide more code, upload a zip of your project or share any notes about your project that may help figure out why this would be happening.
I would suggest you create a basic app as I just did and try running that; if the issue persists you could file a bug, although as I said above event phases are working fine for me.