posting message on Facebook wall via flash/ActionScript

我怕爱的太早我们不能终老 提交于 2020-01-06 06:03:25

问题


I am creating a game that needs to be integrated with Facebook. The game is done and once the user complets that game it adds the button that send score to the Facebook wall of the user.

I have downloaded the Facebook api for flash and is able to connect to the user and get its id. But I don't know what command to use to post the score or message on users wall via swf.

Below is the basic codes...


import com.facebook.data.users.GetInfoData;
import com.facebook.utils.FacebookSessionUtil;
import com.facebook.data.users.FacebookUser;
import com.facebook.data.users.GetInfoFieldValues;
import com.facebook.data.friends.GetFriendsData;
import com.facebook.commands.users.GetInfo;
import com.facebook.commands.friends.*;
import com.facebook.net.FacebookCall;
import com.facebook.events.FacebookEvent;
import com.facebook.Facebook;

var fbook:Facebook; // Creating variable for facebook instance
var session:FacebookSessionUtil; //a utility for flash session is created

session = new FacebookSessionUtil("myAPPIT", "KEY", loaderInfo);// initializing the session
session.addEventListener(FacebookEvent.CONNECT, onFacebookConnect, false, 0, true);// checking if the face book is connected

fbook = session.facebook; // fbook holds the facebook instance as a property
fbook.login(true); // connected to the facebook 


login_btn.addEventListener(MouseEvent.CLICK, connectToFB);
function connectToFB(e:Event):void
{
    session.validateLogin();    
}

function onFacebookConnect(e:FacebookEvent):void
{ 
    trace("Is Facebook connected: " + fbook.is_connected);  

    var call:FacebookCall = fbook.post(new GetInfo([fbook.uid],[GetInfoFieldValues.ALL_VALUES]));

    call.addEventListener(FacebookEvent.COMPLETE,onGetInfo);
}

function onGetInfo(e:FacebookEvent):void
{ 
    var user = (e.data as GetInfoData).userCollection.getItemAt(0) as FacebookUser;
    trace("Hello, " + user.first_name + " " + user.last_name);
} 

回答1:


you need this function

http://developers.facebook.com/docs/reference/rest/stream.publish

quick example could be find here:

http://novacoders.blogspot.com/2010/02/publish-post-to-facebook-wall-news.html



来源:https://stackoverflow.com/questions/3568970/posting-message-on-facebook-wall-via-flash-actionscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!