Can't insert newImageRect into sceneGroup !Total Newb Question! :-(

I’ve been trying to make a simple point and click adventure game (my sisters a graphic designer so it should at least look good) but I have fully fallen at the first hurdle!

I’ve stripped out most of the code to just show the problem. Simple Main.lua taking you to the first scene.

(There is a menu scene but that doesn’t seem to matter)

-- hide the status bar display.setStatusBar( display.HiddenStatusBar ) -- require the composer library local composer = require "composer" -- load scene1 composer.gotoScene( "scene1" )

Then i get an ‘attempt to call method ‘insert’ (a nil value)’ error message when opening scene 1 at line 16.

Which is where the background image is inserted

local composer = require( "composer" ) local scene = composer.newScene()    function scene:create( event )     local sceneGroup = self.view     local background = display.newImageRect("scene1.png", 1000, 1000)     background.x = display.contentWidth\*0.5     background.y = display.contentHeight\*0.5     sceneGroup:Insert( background ) --from here is just the standard composer template     -- Initialize the scene here.     -- Example: add display objects to "sceneGroup", add touch listeners, etc. end -- "scene:show()" function scene:show( event )     local sceneGroup = self.view     local phase = event.phase     if ( phase == "will" ) then         -- Called when the scene is still off screen (but is about to come on screen).     elseif ( phase == "did" ) then         -- Called when the scene is now on screen.         -- Insert code here to make the scene come alive.         -- Example: start timers, begin animation, play audio, etc.     end end -- "scene:hide()" function scene:hide( event )     local sceneGroup = self.view     local phase = event.phase     if ( phase == "will" ) then         -- Called when the scene is on screen (but is about to go off screen).         -- Insert code here to "pause" the scene.         -- Example: stop timers, stop animation, stop audio, etc.     elseif ( phase == "did" ) then         -- Called immediately after scene goes off screen.     end end -- "scene:destroy()" function scene:destroy( event )     local sceneGroup = self.view     -- Called prior to the removal of scene's view ("sceneGroup").     -- Insert code here to clean up the scene.     -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene

i’ve seen this question asked and answered but despite changing where the background is created or declared I can’t load the background to the sceneGroup.

I’ve only just started using Corona so some starter advice would be great!

Corona SDK is case sensitive.  There is no method “Insert”, there is one called “insert”.

Rob

amazing Rob Thanks!!

I’ll follow the documentation more closely in future!

Corona SDK is case sensitive.  There is no method “Insert”, there is one called “insert”.

Rob

amazing Rob Thanks!!

I’ll follow the documentation more closely in future!