MauMau
December 21, 2010, 3:44am
1
Having some problems attaching an enterFrame event to a group:
[lua]MyGroup = display.newGroup()
function Group:startEnterFrameStuff()
– SOLUTION A - DOES NOT DO ANYTHING:
self:addEventListener(“enterFrame”, function() print(“HELLO!”) end )
– SOLUTION B - DOES WORK:
Runtime:addEventListener(“enterFrame”, function() print(“HELLO!”) end )
end
MyGroup:startEnterFrameStuff()[/lua]
Why is this? Shouldn’t solution A work, too? [import]uid: 9644 topic_id: 4630 reply_id: 304630[/import]
MauMau
December 21, 2010, 3:51am
2
Strange o_O
It works with the “touch” event, but not with “enterFrame”:
This one works:
[lua]self:addEventListener(“touch”, function() print(“HELLO!”) end )[/lua]
Does not work:
[lua]self:addEventListener(“enterFrame”, function() print(“HELLO!”) end )[/lua]
Is this a known issue? [import]uid: 9644 topic_id: 4630 reply_id: 14659[/import]
dweezil
December 21, 2010, 4:24am
3
Isn’t the enterFrame event just a runtime event? [import]uid: 9371 topic_id: 4630 reply_id: 14660[/import]
MauMau
December 21, 2010, 5:15am
4
You are right, it seems that I overlooked this part of the docs:
"In contrast, Runtime events are dispatched by the system. They are broadcast to all listeners."
Thanks for pointing it out. [import]uid: 9644 topic_id: 4630 reply_id: 14662[/import]