-2
我正在做一個Facebook應用程序(Flash),我必須邀請朋友。我到達的每個地方都找到了這段代碼,但不適合我,因爲result.request_ids爲空。我需要知道用戶邀請了多少朋友!請幫忙!!!如何邀請與AS3的Facebook應用程序的朋友
代碼:
private function inviteFriends():void{
var dat:Object = new Object();
dat.message = "Let's invite friends for our Super Extra Max Facebook App, more info go to http://blog.ukasz.com";
dat.title = 'Super Extra Max Facebook App';
// filtering for non app users only
dat.filters = ['app_non_users'];
//You can use these two options for diasplaying friends invitation window 'iframe' 'popup'
Facebook.ui('apprequests', dat, onUICallback, 'popup');
}
private function onUICallback(result:Object):void{
if(result == null){
trace('User closed the pop up window without inviting any friends');
return
}
var invitedUsers:Array = new Array();
invitedUsers = result.request_ids as Array;
trace('You Have Invited ', invitedUsers.length,' friends');
//Simple if else if you want user to invite certain amount of friends
if(invitedUsers.length > 1){
trace('GREAT, USER IS GENERATING TRAFFIC');
}else{
trace('No Good, User invited only one friend.');
}
}
解決的辦法是改變 「result.request_ids」 爲 「result.to」。 Facebook改變了它。 – 2012-02-09 15:22:21
@JoaquínFernández,如果你已經解決了這個問題,你可以發佈你自己的答案:) – Lix 2012-02-09 15:33:00
我是新的Stackoverflow,感謝您的建議。 ;) – 2012-02-09 16:08:49