I know this may be easy but I am missing something simple. but why will this not show on my main screen?
[code]-----------------------------------------------------------------------------------------
– menu.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– include Corona’s “widget” library
local widget = require “widget”
– forward declarations and other locals
local playBtn
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
print(“goto scene”)
– go to level1.lua scene
storyboard.gotoScene( “scene1”)
return true – indicates successful touch
end
– BEGINNING OF YOUR IMPLEMENTATION
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
local background = display.newRect(0,0,display.contentWidth,display.contentHeight)
background:setFillColor(0,0,0)
group:insert(background)
local myText1= display.newText(“ABOUT US”, 0, 0, native.systemFont, 32)
–myText1.text = “Or you can change the text here”
myText1.x = display.contentWidth /2;
myText1.y = display.contentHeight /6;
myText1:setTextColor(0, 0, 0)
group:insert(myText1)
local myText2= display.newText(“this simply a test”, 0, 0,200, 200, native.systemFont, 16)
myText2.x = display.contentWidth /2;
myText2.y = myText1.y + myText1.contentHeight /2 + myText2.contentHeight /2;
myText2:setTextColor(255, 255, 255)
group:insert(myText2)
– create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
label=“test”,
labelColor = { default={255}, over={128} },
default=“button.png”,
over=“button-over.png”,
width=160, height=40,
onRelease = onPlayBtnRelease – event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 125
– all display objects must be inserted into group
–group:insert( background )
–group:insert( titleLogo )
group:insert( playBtn )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– INSERT code here (e.g. start timers, load audio, start listeners, etc.)
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
– INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.)
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
if playBtn then
playBtn:removeSelf() – widgets must be manually removed
playBtn = nil
end
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched whenever before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
[/code]
----------------------------------------------------------------------------------------- [import]uid: 69302 topic_id: 33126 reply_id: 333126[/import]