Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Scene Manager Not Changing Scenes Correctly? — Gideros Forum

Scene Manager Not Changing Scenes Correctly?

ljp1203ljp1203 Member
edited October 2012 in General questions
Hi all!

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
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("mainmenu")
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", 1, SceneManager.flipWithFade)
		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
createEvent = gideros.class(Sprite)
function createEvent:init()
 
 
	--Background Image
	local background = Bitmap.new(Texture.new("Images/test.png"))
	stage:addChild(background)
 
 
end
I really need help with this, or my app won't work :)

Thanks in Advance!
-Landon
JLS
Lead Coder and Designer

Comments

  • talistalis Guru
    edited October 2012 Accepted Answer
    You are defining event listeners to always to button1, i think the problem is there.
    (in mainmenu.lua)

    You are defining local button1 then defining an event listener to it,
    after you are defining local button2 but the event listener is again registered to button1 withouth any transition effect and the same goes for button3 also.

    So just edit the eventlisteners to corresponding buttons and all will be ok i guess.

Sign In or Register to comment.