简体   繁体   中英

as3 + JavaScript for Facebook graph API

是否可以通过 JavaScript 连接(登录)到 Facebook 图,然后使用 as3 API 进行查询?

The Actionscript API already uses the JavaScript API to communicate with FB, so yes, it is possible (and in fact it is what actually happens when you log in with the AS3 api).

You'll get an access token back when you log in. If you pass that back into your .swf, you can use it to make requests. Otherwise, as long as your browser has been through authentication, you should be able to get the token again like this:

var auth:FacebookAuthResponse = Facebook.getAuthResponse();
var token:String = auth.accessToken;

And then, for example, post to somebody's feed:

var user:String = auth.uid;
var values:Object = 
{ 
    access_token: token,
    name: "Post Title",
    picture: "http://www.mysite.com/myimage.jpg",
    link:"http://www.mysite.com",  
    description: "App description", 
    message: "Message you want to post here."
};

Facebook.api("/" + user + "/feed", callback, values, URLRequestMethod.POST); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM