I know this may be easy

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]

Hey, @babybeanie98, I just glanced at your code real quick and didn’t really test it, but if you remove [text]local group = self.view[/text] from everywhere except in [text]scene:createScene[/text] (meaning, just keep it only inside createScene), I think it should work.

Naomi

Edit: BTW, I’m assuming your code is from menu.lua, and you have [text]storyboard.gotoScene( “menu”, “fade”, 400 )[/text] in main.lua (or something similar), and what you’re trying to do is to get menu.lua appear on screen. [import]uid: 67217 topic_id: 33126 reply_id: 131523[/import]

Hello Namoi,
Nope that didn’t work :(. Its crazy because this use to work. But something happened to computer and messed my code all up. local group = self.view worked before. But I tried removing it anyway just incase. FYI I have a main.lua and menu.lua. And when I copy my code to main.lua the screen stays black :frowning: [import]uid: 69302 topic_id: 33126 reply_id: 131524[/import]

try this in your enterScene function

[code]
function scene:enterScene( event )
storyboard.stage:toFront()
end [import]uid: 7911 topic_id: 33126 reply_id: 131529[/import]

We need to see your main.lua and probably your menu.lua too.

It sounds to me like your main.lua isn’t calling a scene when its done. [import]uid: 19626 topic_id: 33126 reply_id: 131530[/import]

@babybeanie98, you might want to post what you have in main.lua. Also try what @jstrahan suggested and let us know how it goes.

Naomi [import]uid: 67217 topic_id: 33126 reply_id: 131531[/import]

If you have something in your main.lua that’s not being put into a storyboard controlled group, it will stay on top of everything too. This is why we need to see your main.lua. [import]uid: 19626 topic_id: 33126 reply_id: 131585[/import]

Hey, @babybeanie98, I just glanced at your code real quick and didn’t really test it, but if you remove [text]local group = self.view[/text] from everywhere except in [text]scene:createScene[/text] (meaning, just keep it only inside createScene), I think it should work.

Naomi

Edit: BTW, I’m assuming your code is from menu.lua, and you have [text]storyboard.gotoScene( “menu”, “fade”, 400 )[/text] in main.lua (or something similar), and what you’re trying to do is to get menu.lua appear on screen. [import]uid: 67217 topic_id: 33126 reply_id: 131523[/import]

I will try everyones suggestions. @ Robmiracle, believe it or not from the help you gave me in the past worked fine and all I did was copy and paste that info but its not working. I will post the main file when I get internet connection. [import]uid: 69302 topic_id: 33126 reply_id: 131588[/import]

Hello Namoi,
Nope that didn’t work :(. Its crazy because this use to work. But something happened to computer and messed my code all up. local group = self.view worked before. But I tried removing it anyway just incase. FYI I have a main.lua and menu.lua. And when I copy my code to main.lua the screen stays black :frowning: [import]uid: 69302 topic_id: 33126 reply_id: 131524[/import]

try this in your enterScene function

[code]
function scene:enterScene( event )
storyboard.stage:toFront()
end [import]uid: 7911 topic_id: 33126 reply_id: 131529[/import]

We need to see your main.lua and probably your menu.lua too.

It sounds to me like your main.lua isn’t calling a scene when its done. [import]uid: 19626 topic_id: 33126 reply_id: 131530[/import]

@babybeanie98, you might want to post what you have in main.lua. Also try what @jstrahan suggested and let us know how it goes.

Naomi [import]uid: 67217 topic_id: 33126 reply_id: 131531[/import]

So I tried everything nothing worked.
this is what I have in main now, just to have the file

[code]-----------------------------------------------------------------------------------------

– main.lua


– hide the status bar
display.setStatusBar( display.HiddenStatusBar )

– include the Corona “storyboard” module
local storyboard = require “storyboard”

– load menu screen
storyboard.gotoScene( “menu” )
[/code]

but this is what I want in the main

[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: 131642[/import]

You are missing

return scene

right at the end of your menu.lua [import]uid: 13560 topic_id: 33126 reply_id: 131649[/import]

line 11 needs ( ) around “widget”
myText1 color is same as background color
make sure button.png and button-over.png are correct ( case sensitive )
remove local group = self.view from all function except createScene
make sure file is saved as main.lua
return scene at end [import]uid: 7911 topic_id: 33126 reply_id: 131650[/import]

If you have something in your main.lua that’s not being put into a storyboard controlled group, it will stay on top of everything too. This is why we need to see your main.lua. [import]uid: 19626 topic_id: 33126 reply_id: 131585[/import]

I will try everyones suggestions. @ Robmiracle, believe it or not from the help you gave me in the past worked fine and all I did was copy and paste that info but its not working. I will post the main file when I get internet connection. [import]uid: 69302 topic_id: 33126 reply_id: 131588[/import]

Thanks lano78, I realized that as I was posting the file for help. lol [import]uid: 69302 topic_id: 33126 reply_id: 131654[/import]

One other question. When I see an error like this:Runtime error
?:0: attempt to call method ‘setTextColor’ (a nil value)
stack traceback:
[C]: in function ‘setTextColor’
?: in function <?:200>
?: in function <?:229>

how do I know which file it is in or line?
[import]uid: 69302 topic_id: 33126 reply_id: 131655[/import]