I simply wanted to test event handling. When I touch the screen, I want to turn the screen black. I figured it would be easy, but the following code doesn't work for me:
function onTouchDown(event)
application:setBackgroundColor(rgb(0, 0, 0))
end
stage:addEventListener(Event.TOUCHES_BEGIN, onTouchDown)
Comments
it is working try this please.
Its best to test it with images
application:setBackgroundColor(0xFFF)
stage:addEventListener(Event.MOUSE_DOWN , function ()
application:setBackgroundColor(0x000)
end)
If i will find i will post it here.
I always wondered why they didn't support at least one touch event in the player, I can understand how multitouch is not possible with a mouse but it is a little weird. Event.MOUSE_DOWN will work in the player without a problem. Event.TOUCHES_BEGIN will not, etc.