Black screen

Anything wrong with this code , it gives a black screen on my mobile , and it does nothing on the simulator 

local storyboard = require ("storyboard") local scene = storyboard.newScene() local widget = require( "widget" )       local function onSendEmail( event )     -- compose an HTML email with two attachments     local options =     {        to = { "mikecmattar@live.com" },        cc = { "ADD YOUR E-MAIL HERE , P.S DO NOT CHANGE THE E-MAIL ABOVE!" },       subject = "YOUR NAME"     }     native.showPopup("mail", options)          -- NOTE: options table (and all child properties) are optional end   function scene:createScene(event)     local background = display.newImage( "bg.png" ) background.y=0 local emailImage = display.newImage( "email.png" ) emailImage.x = display.contentWidth \* 0.5 emailImage.y = display.contentHeight \* 0.30   local sendEmail = widget.newButton {     left = 10,      top = 300,     width = 298,     height = 56,     label = "Compose Email",     onRelease = onSendEmail }     end               function scene:enterScene(event)       storyboard.purgeScene("start")          end          function scene:exitScene(event) end   function scene:destroyScene(event)   end     scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene)   return scene

Are you calling storyboard.gotoScene() in your main.lua?

Yes ! 

That’s my main.lua file :

local storyboard = require "storyboard" storyboard.gotoScene( "start" )

and that’s my start.lua file : 

-- requires    local storyboard = require ("storyboard") local scene = storyboard.newScene()   -- background   function scene:createScene(event)       local screenGroup = self.view       background = display.newImage("b4g.png")     background.x=130     background.y=239     screenGroup:insert(background)      end   function start(event)     if event.phase == "began" then         storyboard.gotoScene("game", "fade", 400)     end end   function scene:enterScene(event)       background:addEventListener("touch", start)   end   function scene:exitScene(event)     background:removeEventListener("touch", start) end   function scene:destroyScene(event)   end     scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene)   return scene   

What does the image “b4g.png” look like?

What dynamic scaling are you using? (could 130,239 actually be off screen?)

If uncommented, ‘background’ appears to be a global variable.

Is this ALL of your code?

What do you see if you put a print() statement at the first line of each function in your scene?

Hey, @horacebury, it sounds like @mikecmattar found the fix.  See his post here (5th post):  http://forums.coronalabs.com/topic/36929-black-screen/

@mikecmattar, it would’ve been nice if you posted here that you had found your bug and fixed it (and briefly explain how you fixed it) – this way horacebury would not have needed to spend time thinking about how he could help you further when he did not need to.  It’s a courtesy I recommend you consider practicing when you are seeking help.  And posting what fixed it might help others who may end up with the same issue (or who might’ve been wondering what might’ve caused and fixed the problem.)

Naomi

Are you calling storyboard.gotoScene() in your main.lua?

Yes ! 

That’s my main.lua file :

local storyboard = require "storyboard" storyboard.gotoScene( "start" )

and that’s my start.lua file : 

-- requires    local storyboard = require ("storyboard") local scene = storyboard.newScene()   -- background   function scene:createScene(event)       local screenGroup = self.view       background = display.newImage("b4g.png")     background.x=130     background.y=239     screenGroup:insert(background)      end   function start(event)     if event.phase == "began" then         storyboard.gotoScene("game", "fade", 400)     end end   function scene:enterScene(event)       background:addEventListener("touch", start)   end   function scene:exitScene(event)     background:removeEventListener("touch", start) end   function scene:destroyScene(event)   end     scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene)   return scene   

What does the image “b4g.png” look like?

What dynamic scaling are you using? (could 130,239 actually be off screen?)

If uncommented, ‘background’ appears to be a global variable.

Is this ALL of your code?

What do you see if you put a print() statement at the first line of each function in your scene?

Hey, @horacebury, it sounds like @mikecmattar found the fix.  See his post here (5th post):  http://forums.coronalabs.com/topic/36929-black-screen/

@mikecmattar, it would’ve been nice if you posted here that you had found your bug and fixed it (and briefly explain how you fixed it) – this way horacebury would not have needed to spend time thinking about how he could help you further when he did not need to.  It’s a courtesy I recommend you consider practicing when you are seeking help.  And posting what fixed it might help others who may end up with the same issue (or who might’ve been wondering what might’ve caused and fixed the problem.)

Naomi