Hi all!
I'm having a problem with the Gideros Scene Manager. Whenever I try to click on my button called createBtn, I keep getting an error and it won't allow me to advance onto the next scene. And I can't seem to find the source of the problem.
Here are my files,
main.lua
sceneManager = SceneManager.new({
["loadmain"] = loadmain,
["login"] = login,
["mainmenu"] = mainmenu,
["createEvent"] = createEvent,
["Party"] = Party,
["Vacation"] = Vacation,
["Other"] = Other,
["ViewEdit"] = ViewEdit,
["Settings"] = Settings,
["Help"] = Help,
["FAQ"] = FAQ,
["About"] = About,
})
stage:addChild(sceneManager)
sceneManager:changeScene("login") |
mainmenu.lua
mainmenu = gideros.class(Sprite)
function mainmenu:init()
--Background Image
local background = Bitmap.new(Texture.new("Images/test.png"))
stage:addChild(background)
--Create Event Button
local createBtn = Bitmap.new(Texture.new("Images/btn1.png"))
local createBtn_over = Bitmap.new(Texture.new("Images/btn1_over.png"))
--The Actual Button and Listener
local button1 = Button.new(createBtn, createBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("createEvent")
end)
--Add Button To Scene
button1:setPosition(70, 200)
stage:addChild(button1)
-------------------------------------------------------------------------------
--Create Event Button
local viewBtn = Bitmap.new(Texture.new("Images/btn2.png"))
local viewBtn_over = Bitmap.new(Texture.new("Images/btn2_over.png"))
--The Actual Button and Listener
local button2 = Button.new(viewBtn, viewBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("ViewEdit")
end)
--Add Button To Scene
button2:setPosition(70, 450)
stage:addChild(button2)
-------------------------------------------------------------------------------
--Create Event Button
local settingsBtn = Bitmap.new(Texture.new("Images/btn3.png"))
local settingsBtn_over = Bitmap.new(Texture.new("Images/btn3_over.png"))
--The Actual Button and Listener
local button3 = Button.new(settingsBtn, settingsBtn_over)
button1:addEventListener("click",
function()
sceneManager:changeScene("Settings")
end)
--Add Button To Scene
button3:setPosition(70, 700)
stage:addChild(button3)
-------------------------------------------------------------------------------
end |
createEvent.lua
mainmenu = gideros.class(Sprite)
function mainmenu:init()
--Background Image
local background = Bitmap.new(Texture.new("Images/test.png"))
stage:addChild(background)
--This is just a test image.
end |
Here is the error I keep getting:
scenemanager.lua:264: attempt to index field '?' (a nil value)
stack traceback:
scenemanager.lua:264: in function 'changeScene'
main.lua:18: in main chunk
I hope someone can help me with this because I really need this to work, or well then my app is useless
Thanks in Advance!
-Landon
Comments
Lead Coder and Designer
I also notticed that you are adding the backgrounds to the stage. If you want them just to belong to the scene they should be added to self rather than stage.
Good luck!
I'm having a issue with the Gideros Scene Manager.
Everytime I click the button that has the listener for changing scenes, it doesn't use the transition that I put down, it just transitions regulary.
Here are my files:
main.lua
Thanks in Advance!
-Landon
Lead Coder and Designer