I’m trying to add a Facebook button so that when a player finishes a game he/she can brag about it on FB. I’ve tried the example from Michelles new book which works fine, but when I try to add it to my code I get the following error in the terminal…
Runtime error
/Users/home/Desktop/StopIt Solo/ui.lua:124: attempt to index local 'button' (a nil value)
stack traceback:
[C]: ?
/Users/home/Desktop/StopIt Solo/ui.lua:124: in function 'newButton'
/Users/home/Desktop/StopIt Solo/ipad.lua:845: in function '\_listener'
?: in function <?:514>
?: in function <?:215>
The only thing I can think of is that my code uses Director, while the original doesn’t.
The top of my code I have the following…
[lua]module(…, package.seeall)
function new()
local localGroup = display.newGroup()
require “sprite”
facebook=require(“facebook”)
json = require(“json”)
ui=require(“ui”)[/lua]
and further down in my show_results function (where the error occurs)…
[lua] fb_btn=ui.newButton{
defaultSrc=“gfx/facebook.png”,
defaultX=64,
defaultY=64,
overSrc=“gfx/facebook_over.png”,
overX=64,
overY=64,
onEvent=onFBTouch,
}
fb_btn.y=850
fb_btn.x=_w/3[/lua]
Any help at all would be greatly appreciated. [import]uid: 7841 topic_id: 26104 reply_id: 326104[/import]
