main is correct! You have to use the Scene Template in your home to create a valid scene in it. Pixec left the link above for you to take the scene code template and insert it into your home.
All your code has to be within the scene structure, you put your code after the return scene! return scene is the last code of your file, there can be nothing below it. try placing your code below: function scene: create (event) local sceneGroup = self.view
Composer will fail if the scene it is trying to load has a formatting error, and won’t necessarily tell you what that error is.
Get a blank composer scene working, and gradually add your code in. People don’t have time to look through 300 lines of code, and they can’t run it because they don’t have the images.
yea i did in the main.lua there was just
Local composer = require (“composer”)
composer.gotoScene (“menu2”)
And in the menu2.lua there is just the template you guys sent me and in between it sfondo = display.newImageReact ("Sfondi/icons/sfondonero2) and it still doesnt work
sorry idk what u by <>format, im new to corona amd lua btw the menu code is this (main.lua is just local composer = require (“composer”)
composer.gotoScene (“menu2”)
Menu2:
local composer = require( “composer” )
local scene = composer.newScene()
– Code outside of the scene event functions below will only be executed ONCE unless
– the scene is removed entirely (not recycled) via “composer.removeScene()”
– Scene event functions
– create()
function scene:create( event )
local sceneGroup = self.view
device_width = display.contentWidth --larghezza in pixel dello schermo del tel
device_height = display.contentHeight --altezza in pixel dello schermo del tel
local coomposer = require (“composer”)
–impostazione sfondo
local sfondo = display.newImageRect( “sfondonero.png”,device_width,device_height)
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is still off screen (but is about to come on screen)
elseif ( phase == “did” ) then
– Code here runs when the scene is entirely on screen
end
end
– hide()
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Code here runs when the scene is on screen (but is about to go off screen)
elseif ( phase == “did” ) then
– Code here runs immediately after the scene goes entirely off screen
end
end
– destroy()
function scene:destroy( event )
local sceneGroup = self.view
– Code here runs prior to the removal of scene’s view
end
– Scene event function listeners
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
When you type here in the forum, before posting, you have a button with this symbol <> on the top of the text field, select your entered code and click this icon to format your code at the time you click post.
What error message is appearing?
Your code is apparently correct! Are the main.lua and menu2.lua files in the same directory as folders? Is the filename menu2.lua spelled the same as you typed in the code?
Can you try what I suggested? Get a blank composer template, call it menu2.lua, and see if it works. Then you know it’s your code.
That error may be a red-herring, as I said if it tries to load a scene and it can’t parse the Lua it will throw an error before it even starts running the code in the scene.
i tried and it composer works if on “home2” there aren’t lines of code, but as soon as i try to add a the change scene templete it gives me this error https://gyazo.com/e40f0fdd40248e85d007224237ca7ea6