I have a display group that has a touch event on it so I can move the object around the screen as it’s touched. This group has children that I want to fire custom events from and bubble them up.
the code looks something like this.
[lua]local group = display.newGroup()
local function onTouch(event)
if event.phase == “began” then
display.getCurrentStage():setFocus(event.target, event.id)
elseif event.phase == “moved” then
–do something
elseif event.phase == “ended” then
display.getCurrentStage():setFocus(event.target, nil)
end
end
group:addEventListener(“touch”, onTouch)
local function buttonClicked(event)
–here i dispatch another custom event to the groups parent
local e = {name=“someevent”, value=“something”}
group:dispatchEvent(e)
end
local my_bn = Button:new()
my_bn:addEventListener(“customEvent”, buttonClicked)
group:insert(my_bn)
return group[/lua]
The issue I am having is that after the button that is inside the group is clicked the only part of the event phase that is triggered is the “began” phase and the custom event is never heard and caught in the buttonClicked function.
I come from a Flash background and this used to be any issue with Movieclips back in the day. You could not listen for click events on objects that where inside of a sprite or movieclip that had event listening applied to it. Is this the same case for corona ? [import]uid: 7501 topic_id: 17924 reply_id: 317924[/import]
[import]uid: 52491 topic_id: 17924 reply_id: 68544[/import]