Composer, strange error message

hey, im trying to get an nice menu for my game, ut i have some prolems with composer.

thers the code - whats wrong? i cant find the issuse - the code is not changing the scenes…

display.setStatusBar(display.HiddenStatusBar)

screenW, screenH, halfW, halfH = display.contentWidth, display.contentHeight, display.contentWidth/2, display.contentHeight/2

_H = display.contentHeight;

_W = display.contentWidth;

centerX = display.contentCenterX

centerY = display.contentCenterY

local composer = require(“composer”)

local scene = composer.newScene()

local widget = require “widget”

sceneGroup = display.newGroup()

function scene:create( event )

  local sceneGroup = self.view

end

function tscreenView()

local function onEndlessRelase()

composer:gotoScene( “endless”, “fade”, 500 )

return true

end

local function onChaptRelase()

composer:gotoScene( “endless”, “fade”, 500 )

return true

end

local function onCredbtnRelase()

composer:gotoScene( “creds”, “fade”, 500 )

return true

end

local endlessbtn = widget.newButton

{

    defaultFile = “endlessbtn.png”,

    label = “endlessbtn”,

    onEvent = onEndlessRelase

}

endlessbtn.anchorX = 0.5

endlessbtn.anchorY = 0.5

endlessbtn.y = _H/2 + 50

endlessbtn.x = _W/2 - 55

sceneGroup:insert(endlessbtn)

local chapt = widget.newButton

{

    defaultFile = “chaptbtn.png”,

    label = “chapt”,

    onEvent = onChaptRelase

}

chapt.anchorX = 0.5

chapt.anchorY = 0.5

chapt.y = _H/2 + 360

chapt.x = _W/2 - 5

sceneGroup:insert(chapt)

local credbtn = widget.newButton

{

    defaultFile = “creditbtn.png”,

    label = “credbtn”,

    onEvent = onCredbtnRelase

}

credbtn.anchorX = 0.5

credbtn.anchorY = 0.5

credbtn.y = (_H/2)/0.5 -50

credbtn.x = _W/2

sceneGroup:insert(credbtn)

end

local ts = display.newImage(“factory.png”)

ts.anchorX = 0.5

ts.anchorY = 0.5

ts.x = _W/2

ts.y = _H/2

display.remove(factorybg)

ts.isVisible = true

sceneGroup:insert(ts)

factorybg = display.newImage(“tscreenbg.png”)

factorybg.anchorX = 0.5

factorybg.anchorY = 0.5

factorybg.x = _W/2

factorybg.y = _H/2

sceneGroup:insert(factorybg)

transition.from(factorybg, {delay=3000, time=200, x=-_W, onComplete=tscreenView});

function scene:enter(event)

  local group = self.view

  if(composer.getPrevious() ~= nil) then

    composer.purgeScene(composer.getSceneName())

    composer.removeScene(composer.getSceneName())

  end

end

scene:addEventListener(“create”, scene)

scene:addEventListener(“enter”, scene)

return scene

I would suggest you look in your console log to see if you’re getting any errors. You have several errors.  For instnace there is no “enter” event for Composer.  Its scene:show.  enterScene was a Storyboard construct.  Like wise there is no purgeScene and I suspect your app is crashing with these errors. 

Rob

thank you for your early post.

still i didn´t understand composer, or storryboard or whatever,

i tryed it simple, by switching from one screen with a background to an other screen with a background,

with an “fade” effect.

Theres the code:

main.lua::

local composer = require( "composer" ) local scene = composer.newScene() function scene:show(event) bgf = display.newImage("factory.png") bgf.anchorX = 0.5 bgf.anchorY = 0.5 bgf.x = \_W/2 bgf.y = \_H/2 end function scene:hide() local options = { effect = "fade", time = 50, } composer.gotoScene( "menue", options ) end scene:addEventListener( "show", scene ) scene:show() scene:addEventListener( "hide", scene ) return scene 

and the menue.lua

local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. bg = display.newImage("tscreenbg.png") bg.anchorX = 0.5 bg.anchorY = 0.5 bg.x = \_W/2 bg.y = \_H/2 end scene:addEventListener( "create", scene ) scene:create() return scene 

the thing is, the simulator shows me directly the menue background.

i tryed it with en timer, included in main.lua, calling the scene:hide() function, but this wont not work.

I would recommend spending some time with the Composer tutorials and studying the Composer sample apps. 

http://coronalabs.com/blog/2014/06/03/tutorial-understanding-the-composer-api/

http://coronalabs.com/blog/2014/01/21/introducing-the-composer-api-plus-tutorial/

http://docs.coronalabs.com/guide/system/composer/index.html

And look in the CoronaSDK/SampleCode/Interface/Composer sample app.

Rob

ouh, so bad >.<

ok thank you :slight_smile:

i tryed some of them and had some problems.

i got an error by putting objects (like a background in this case) into the self.view sceneGroup - it doesn´t work maybe ther could be the issuse?

I would suggest you look in your console log to see if you’re getting any errors. You have several errors.  For instnace there is no “enter” event for Composer.  Its scene:show.  enterScene was a Storyboard construct.  Like wise there is no purgeScene and I suspect your app is crashing with these errors. 

Rob

thank you for your early post.

still i didn´t understand composer, or storryboard or whatever,

i tryed it simple, by switching from one screen with a background to an other screen with a background,

with an “fade” effect.

Theres the code:

main.lua::

local composer = require( "composer" ) local scene = composer.newScene() function scene:show(event) bgf = display.newImage("factory.png") bgf.anchorX = 0.5 bgf.anchorY = 0.5 bgf.x = \_W/2 bgf.y = \_H/2 end function scene:hide() local options = { effect = "fade", time = 50, } composer.gotoScene( "menue", options ) end scene:addEventListener( "show", scene ) scene:show() scene:addEventListener( "hide", scene ) return scene&nbsp;

and the menue.lua

local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. bg = display.newImage("tscreenbg.png") bg.anchorX = 0.5 bg.anchorY = 0.5 bg.x = \_W/2 bg.y = \_H/2 end scene:addEventListener( "create", scene ) scene:create() return scene&nbsp;

the thing is, the simulator shows me directly the menue background.

i tryed it with en timer, included in main.lua, calling the scene:hide() function, but this wont not work.

I would recommend spending some time with the Composer tutorials and studying the Composer sample apps. 

http://coronalabs.com/blog/2014/06/03/tutorial-understanding-the-composer-api/

http://coronalabs.com/blog/2014/01/21/introducing-the-composer-api-plus-tutorial/

http://docs.coronalabs.com/guide/system/composer/index.html

And look in the CoronaSDK/SampleCode/Interface/Composer sample app.

Rob

ouh, so bad >.<

ok thank you :slight_smile:

i tryed some of them and had some problems.

i got an error by putting objects (like a background in this case) into the self.view sceneGroup - it doesn´t work maybe ther could be the issuse?