Hello,
I'm trying to handle touch, mouse and key input, but the events does not seem to fire.
This is my code:
| --[[
 filename : Test.lua
--]]
 
Test = Core.class(Sprite)
 
function Test:init()
    self.speed 	= 3
	self.PosX 	= 50
	self.PosY  	= 50
	self.DirX	= 1
	self.DirY	= 1
 
	self:addEventListener(Event.KEY_DOWN, self.onKeyDown, self)
	self:addEventListener(Event.MOUSE_DOWN, self.onKeyDown, self)
	self:addEventListener(Event.TOUCHES_END, self.onKeyDown, self)
end
 
...
 
function Test:onKeyDown(event)
	self.PosY = self.PosY + 10
	print("key down")
end
 
function Test:move()
	self.PosX = self.PosX + 1
	self.headBody:setPosition(self.PosX, self.PosY)
end | 
| --[[
 filename : main.lua
--]]
 
...
 
local fixtureDef = {shape = shape, density = 2, restitution = 0.7}
 
local test = Test.new()
test:create(actors, fixtureDef, b2, world, stage)
...
 
local function onEnterFrame()
	world:step(1/60, 8, 3)
 
	test:move()
 
        ...
 
end
 
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) | 
The move-function is called from the 'main.loop' correctly.
But the Eventhandlers do not work. The debug-output is not called either.
Any idea what I'm doing wrong? Many thanks in advance.                
Comments
I think to receive events it should be in stage hierarchy.
This was the problem, thank you