【问题标题】:How to invite friends in Facebook app with AS3如何使用 AS3 在 Facebook 应用中邀请朋友
【发布时间】:2012-02-09 14:45:30
【问题描述】:

我正在制作一个必须邀请朋友的 Facebook 应用程序 (Flash)。我到达的每个地方都找到了这段代码,但对我不起作用,因为 result.request_ids 为空。我需要知道用户邀请了多少朋友!!!请帮忙!!!

代码:

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.');
}

}

【问题讨论】:

    标签: facebook flash actionscript-3 facebook-graph-api


    【解决方案1】:
    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);
        }
    

    【讨论】:

    • 解决方案是将“result.request_ids”更改为“result.to”。 Facebook 改变了它。
    • @JoaquínFernández,如果您已解决此问题,您可以发布自己的答案 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    • 1970-01-01
    • 2012-09-16
    相关资源
    最近更新 更多