2012-02-09 2 views
-2

나는 친구를 초대해야하는 Facebook 애플리케이션 (플래시)을 만들고 있습니다. 모든 곳에서 나는이 코드 조각을 발견했지만 result.request_ids가 null이기 때문에 저를 위해 일하지 않습니다. 사용자가 얼마나 많은 친구를 초대했는지 알고 싶습니다. 도와주세요!!!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.'); 
} 

}

답변

0
function invite(evt:MouseEvent):void 
    { 
     var obj:Object = 
     { 
      message: "", 
      title: "" 
     }; 
     Facebook.ui("apprequests", obj, cbi, "iframe"); 
    } 

function cbi(res):void 
    { 
     field_txt.appendText(res.request_ids); 
    } 
+0

이 솔루션은 "result.to"에 대한 "result.request_ids"로 변경했다. 페이스 북이 그것을 바꿨다. –

+0

@ JoaquínFernández,이 문제를 해결 한 경우 자신의 답변을 게시 할 수 있습니다 :) – Lix

+0

저는 Stackoverflow에서 새로운 조언을 주셔서 감사합니다. ;) –

관련 문제