Hi all,
I thought I’d run things through here before bringing it to bug reporting.
I’m just about done with my app’s framework but I wanted to add two extra buttons on my front page, leading to simple background images that will lead back when touched.
Oddly, I get these results, while all the other buttons work fine:
Runtime error
…Users/lionelhoude/Desktop/mitm/fixdmitm/director.lua:116: attempt to call field ‘new’ (a nil value)
stack traceback:
[C]: in function ‘new’
…Users/lionelhoude/Desktop/mitm/fixdmitm/director.lua:116: in function ‘loadScene’
…Users/lionelhoude/Desktop/mitm/fixdmitm/director.lua:394: in function ‘changeScene’
/Users/lionelhoude/Desktop/mitm/fixdmitm/menu.lua:72: in function
?: in function <?:226>
My code is:
[code]
module(…, package.seeall)
function new()
local localGroup = display.newGroup()
ego = require “ego”
saveFile = ego.saveFile
loadFile = ego.loadFile
local function switchOut()
director:changeScene (“blue”)
end
local volume= loadFile( “volume.txt” )
if volume==“empty” then volume=1.0
end
audio.setVolume( volume )
_G.pizz= loadFile( “gotcha.txt” )
local background = display.newImage (“bg.png”)
localGroup:insert(background)
backgroundMusic = audio.loadStream(“title.mp3”)
backgroundMusicChannel = audio.play( backgroundMusic, { channel=1, loops=0, fadein=5000 } )
local redbutton = display.newImage (“options.png”)
redbutton.x = 160
redbutton.y = 350
localGroup:insert(redbutton)
local about = display.newImage (“aboutbut.png”)
about.x = 160
about.y = 150
localGroup:insert(about)
local credito = display.newImage (“credits.png”)
credito.x = 160
credito.y = 450
localGroup:insert(credito)
local yellowbutton = display.newImage (“continue.png”)
yellowbutton.x = 160
yellowbutton.y = 400
localGroup:insert(yellowbutton)
yellowbutton.isVisible=false
if _G.pizz==“save” then
yellowbutton.isVisible=true
end
local bluebutton = display.newImage (“start.png”)
bluebutton.x = 160
bluebutton.y = 300
localGroup:insert(bluebutton)
local function pressRed (event)
if event.phase == “ended” then
director:changeScene (“red”)
end
end
local function pressBlue (event)
if event.phase == “ended” then
director:changeScene (“yellow”)
end
end
local function creddy (event)
if event.phase == “ended” then
director:changeScene (“credits”)
end
end
local function pressYellow (event)
if event.phase == “ended” then
saveFile( “gotcha.txt”, “save”)
_G.pizz=“save”
_G.usedo = loadFile( “used.txt” )
_G.mo = tonumber(loadFile( “m.txt” ))
_G.ro = tonumber(loadFile( “r.txt” ))
_G.so = tonumber(loadFile( “s.txt” ))
_G.testero = loadFile( “tester.txt” )
_G.tossPVo=tonumber(loadFile(“tosser.txt”))
_G.modeyo=tonumber(loadFile(“modey.txt”))
_G.justTossedo=tonumber(loadFile(“just.txt”))
_G.thediffo=tonumber(loadFile(“thediff.txt”))
timer.performWithDelay(1000, switchOut, 1)
end
end
redbutton:addEventListener (“touch”, pressRed)
bluebutton:addEventListener (“touch”, pressBlue)
credito:addEventListener (“touch”, creddy)
yellowbutton:addEventListener (“touch”, pressYellow)
return localGroup
end[/code]
Am I exceeding some listener limit? Any help is appreciated. Thank you! [import]uid: 144359 topic_id: 28053 reply_id: 328053[/import]
[import]uid: 84637 topic_id: 28053 reply_id: 113982[/import]
[import]uid: 144359 topic_id: 28053 reply_id: 114333[/import]