I’m trying to use a background image with a practice project I’m working on. But when I use localGroup:insert to activate the three system text lines that I’m using as buttons that have event listeners, the background image is the only thing that is seen. If I “comment out” the three localGroup:insert, then the three text buttons reappear, but of course they can’t work. So what am I doing wrong? Here is my code. If you remove the – of lines 53, 54, and 55, the background will cover everything. If you comment out line 6, the text buttons will appear.
Thanks!
[lua]module(…, package.seeall)
display.setStatusBar( display.HiddenStatusBar )
local background = display.newImage( “kwkbackground.png”, 0, 0, true )
–background.x = display.contentWidth / 2
–background.y = display.contentHeight / 2
function new()
– we store everything inside this group at the end
local localGroup = display.newGroup()
– change scene function
function changeScene(e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene, “moveFromRight”);
end
end
– load cms site
local function visitSite(e)
system.openURL( “http://psimediapublishers.com/products.htm” )
end
– menu buttons
local hopeThisWorks = display.newText( “New Play Button”, 0, 0, native.systemFontBold, 64)
hopeThisWorks:setReferencePoint(display.CenterReferencePoint);
hopeThisWorks.x = _w/2;
hopeThisWorks.y = _h/2-100;
hopeThisWorks.scene = “selectlevel”;
hopeThisWorks:addEventListener(“touch”, changeScene);
local btn_exit = display.newText(“Exit”, 0, 0, native.systemFontBold, 64);
btn_exit:setReferencePoint(display.CenterReferencePoint);
btn_exit.x = _w/2;
btn_exit.y = _h/2;
btn_exit.scene = “exit”;
btn_exit:addEventListener(“touch”, changeScene);
local btn_apps = display.newText(“See Our Other Apps!”, 0, 0, native.systemFontBold, 64);
btn_apps:setReferencePoint(display.CenterReferencePoint);
btn_apps.x = _w/2;
btn_apps.y = _h/2+100;
btn_apps.scene = “apps”;
btn_apps:addEventListener(“touch”, visitSite);
— insert everything into the localGroup
–localGroup:insert(hopeThisWorks)
–localGroup:insert(btn_exit)
–localGroup:insert(btn_apps)
– clean everything up
clean = function ()
end
– do not remove lest the sky shalt fall upon thine head
return localGroup
end
[lua] [import]uid: 39859 topic_id: 34263 reply_id: 334263[/import]