Hey
We are about to launch our first Corona made game and now we are connecting Facebook and OpenFeint. But when we have game over and we display a alertbox and the user choose Post to facebook it just flashes and then hangs?
[lua]function onAlertDone( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
print (“main menu”)
elseif 2 == i then
print (“retry”)
restartGame()
elseif 3 == i then
print (“facebook”)
tenfingers.fbLogin(counterText1.text)
end
i = nil
end
end[/lua]
We have loacal tenfingers = require(“tenfingers.lua”) so we call the facebook connect routine by the above tenfingers.fbLogin and we send the score value to that routine.
facebook login function
[lua]function fbLogin(score)
scoreToPost = score
facebook.login( fbAPI, fblistener, { “publish_stream”} )
end[/lua]
the post function
[lua]-- facebook post function
function facebookPost(theMessage)
facebook.request( “me/feed”, “POST”, {
message=theMessage,
name=“Catchem The Game by 10FINGERS”,
caption=“read more and challenge your friends”,
link=“http://www.catchemgame.com” } )
end[/lua]
the facebook listener
[lua]-- listener for “fbconnect” events
function fblistener( event )
if ( “session” == event.type ) then
– upon successful login, request list of friends
if event.phase ~= “login” then
– Exit if login error
return
end
–if ( “login” == event.phase ) then
–end
facebook.request( “me” )
elseif ( “request” == event.type ) then
– event.response is a JSON object from the FB server
local response = event.response
– if request succeeds, create a scrolling list of friend names
if ( not event.isError ) then
response = json.decode( event.response )
facebookPost(“Just played Catchem and scored " … scoreToPost … " and had a blast! You try if you can beat me!”)
end
elseif ( “dialog” == event.type ) then
end
end[/lua]
Any tips and ideas are welcome. [import]uid: 22737 topic_id: 10596 reply_id: 310596[/import]