Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Problem with Back Button — Gideros Forum

Problem with Back Button

QuasarCreatorQuasarCreator Member
edited June 2012 in General questions
Today I have been trying to implement a back button, however, once I added the code to my file I was getting an error saying. I was getting no errors before I added the back button. Here is the code for my back button.

Here is the error I am getting:
pvp_level_select.lua:101: attempt to index global 'backButton' (a nil value)
stack traceback:
	pvp_level_select.lua:101: in function 'init'
	[string "property.lua"]:164: in function 'new'
	classes/scenemanager.lua:277: in function 'changeScene'
	menu.lua:27: in function <menu.lua:25>

Here is my button (I am trying to go from my pvp_level_select scene to my menu scene)
 local backButton = Button.new(Bitmap.new(Texture.new("Images/backbutton_u.png")),
	Bitmap.new(Texture.new("Images/backbutton_d.png")))
	--top right
	backButton:setPosition(dx+application:getContentWidth()-bitmap:getWidth(), -dy)
	self:addChild(backButton)
 
		backButton:addEventListener("click", 
		function()	
			sceneManager:changeScene("menu", 1, SceneManager.flipWithFade, easing.outBack) 
		end
	)




If anyone could help me out on this it would be much appreciated!






I am a programming noobie, so thanks in advance for helping me out and answering my questions!

Comments

Sign In or Register to comment.