我们已经搜索并建立了一周没有运气的测试。我觉得答案很简单或不可能。
如果您有解决方案,请提供帮助。 感谢
答案 0 :(得分:0)
我认为目前的最佳做法是通过javascript SDK获取所有内容,并通过外部接口将这些对象传递给swf。
一个例子..(确保你的swf的id是“flashObj”)
Javascript代码:
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<INSERT YOUR APP-ID>', status: false, cookie: true, xfbml: false});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
function connectUser() {
FB.api('/me', function(response) {
var usrs = new Array();
usrs.push(response);
document.getElementById('flashObj').loadUser(usrs);
});
};
function requestLogin()
{
FB.login(function(response) {
if (response.session) {
if (response.perms) {
document.getElementById('flashObj').onLogin();
} else {
// user is logged in, but did not grant any permissions
}
} else {
// user is not logged in
}
}, {perms:'email,user_birthday'});
}
</script>
然后在AS3中:
public function FBconnect():void {
ExternalInterface.addCallback("onLogin", onLogin);
ExternalInterface.call("requestLogin");
}
private function onLogin():void {
trace("FB LOGIN");
connectUser();
}
private function connectUser():void {
ExternalInterface.addCallback("loadUser", userCallback);
ExternalInterface.call("connectUser");
}
private function userCallback(data:Array):void {
trace("FB USER LOADED");
var userData:Object = data[0];
traceObject(userData);
_FBuser = new FBUser(userData.id);
_FBuser.firstName = userData.first_name;
_FBuser.lastName = userData.last_name;
var d:Date = new Date(String(userData.birthday));
_FBuser.birthDate = d;
_FBuser.gender = userData.gender;
_FBuser.email = userData.email;
dispatchEvent(new Event(Event.COMPLETE));
}