I’m trying out the screen pages with director.
I have a level 1 and an about page, each have a back button on them to go back to the menus.
Here is my about page.
[code]
module(…, package.seeall)
– Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
– Above is the standard stuff, commented in MENU.LUA
– SCENE SETUP –
local background = display.newImage (“images/bluescreen.png”)
localGroup:insert(background)
– Sets the background
local aboutText = display.newText("", 0, 0, native.systemFontBold, 17)
aboutText:setReferencePoint(display.CenterReferencePoint)
aboutText.x = display.contentWidth * 0.5
aboutText.y = display.contentHeight * 0.5 - 40
aboutText:setTextColor(238, 238, 238) – #EEEEEE
aboutText.text = “War Dogs is about\n Dogs of War”
local aboutText2 = display.newText("", 0, 0, native.systemFontBold, 13)
aboutText2:setReferencePoint(display.CenterReferencePoint)
aboutText2.x = display.contentWidth * 0.5
aboutText2.y = aboutText.y + 17
aboutText2:setTextColor(238, 238, 238) – #EEEEEE
aboutText2.text = “For more information and updates visit:”
local link = display.newText("", 0, 0, native.systemFontBold, 12)
link:setReferencePoint(display.CenterReferencePoint)
link.x = display.contentWidth * 0.5
link.y = aboutText2.y + 30
link:setTextColor(229, 175, 6) – #E5AF06
link.text = “http://link.com”
–=======================SO Back Button
local backbutton = display.newImage (“images/back.png”)
backbutton.x = display.contentWidth * 0.1
backbutton.y = display.contentHeight * 0.9
localGroup:insert(backbutton)
– Sets the icon for back Button
local function gotoback (event)
director:changeScene(“menu”)
aboutText.text = " "
aboutText2.text = " "
link.text = " "
end
backbutton:addEventListener(“tap”, gotoback)
– Below is the standard stuff, commented in MENU.LUA
– MUST return a display.newGroup()
return localGroup
end[/code]
When I go back the text stays on the screen. I added blank .text= in the function to go back, is that the correct way of doing this?
Also on my level 1 page I have the same back button, but it doesn’t do anything. The debugger screen just says- Loading our data…
[import]uid: 78446 topic_id: 12956 reply_id: 312956[/import]