I have a options button on my menu and when i press it i get this error
[code]
Runtime error
/Users/Mazensalih/Documents/penguin1/director.lua:615: attempt to index field ‘?’ (a boolean value)
stack traceback:
[C]: ?
/Users/Mazensalih/Documents/penguin1/director.lua:615: in function ‘loadScene’
/Users/Mazensalih/Documents/penguin1/director.lua:842: in function ‘loadNextScene’
/Users/Mazensalih/Documents/penguin1/director.lua:1017: in function ‘changeScene’
/Users/Mazensalih/Documents/penguin1/menu.lua:59: in function
?: in function <?:215>
–This is my menu below
module(…, package.seeall)
new = function ( params )
– Imports
local ui = require ( “ui” )
– Groups
local localGroup = display.newGroup()
– Audio
– Display Objects
local background = display.newImage( “background.png”)
localGroup:insert( background )
local title = display.newText( “Penguin Control”, 0, 0, native.systemFontBold, 32 )
localGroup:insert( title )
– Image
local bubble = display.newImage( “bubble1.png” )
localGroup:insert( bubble )
local penguin = display.newImage( “penguin.png” )
localGroup:insert( penguin )
local btParameters = display.newText( “Start”, 0, 0, native.systemFontBold, 32 )
localGroup:insert( btParameters )
local options = display.newText( “Options”, 0, 0, native.systemFontBold, 32 )
localGroup:insert( options )
– Listener
local btParameterst = function ( event )
if event.phase == “ended” then
director:changeScene(“level1”)
end
end
local function pressOptions (event)
if event.phase == “ended” then
director:changeScene (“options”)
end
end
options:addEventListener (“touch”, pressOptions)
–====================================================================–
– INITIALIZE
–====================================================================–
local initVars = function ()
– Inserts
– Positions
title.x = 225
title.y = 20
btParameters.x = 225
btParameters.y = 150
bubble.x = 225
bubble.y = 190
penguin.x = 45
penguin.y = 265
options.x = 225
options.y = 190
– Colors
title:setTextColor( 255,255,255 )
btParameters:setTextColor( 300,455,255 )
options:setTextColor( 300,455,255 )
– Listeners
btParameters:addEventListener ( “touch” , btParameterst )
end
– Initiate variables
initVars()
– MUST return a display.newGroup()
return localGroup
end
[import]uid: 132369 topic_id: 25435 reply_id: 325435[/import]