简体   繁体   English

用于 Facebook 图形 API 的 as3 + JavaScript

[英]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). Actionscript API 已经使用 JavaScript API 与 FB 通信,所以是的,这是可能的(实际上这就是使用 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.当您登录时,您将获得一个访问令牌。如果您将其传递回您的 .swf,您可以使用它来发出请求。 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); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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