Hi
I have updated the TabBar sample to fit my requirements to display screens. The following, trying to do a simple display a screen on a back group is touched. However, for some reasons, the system displays error on the addEventListeners
– Main
function loadScreen(newScreen)
if currentScreen then
currentScreen:cleanUp()
end
currentScreen = require(newScreen).new()
mainView:insert(currentScreen)
return true
end
local function init()
–Create a group that contains the entire screen and tab bar
mainView = display.newGroup()
loadScreen(“screen1”)
return true
end
–Start the program!
init()
– Screen 1
module(…, package.seeall)
function new()
local g = display.newGroup()
local background = display.newImage(“b.png”)
g:insert(background)
local message = display.newText(“Screen 1”, 0, 0, native.systemFontBold, 16)
message:setTextColor(0, 0, 0)
message.x = display.contentWidth*0.5
message.y = display.contentHeight*0.5
g:insert(message)
background:addEventListener(“touch”, loadScreen(“screen2”))
function g:cleanUp()
g:removeSelf()
end
return g
end
[import]uid: 11038 topic_id: 3570 reply_id: 303570[/import]
its really killing me [import]uid: 11038 topic_id: 3570 reply_id: 10775[/import]