如何在Facebook上发布Flash小程序?

时间:2011-12-15 08:58:29

标签: facebook flash

this question的评论中,用户评论说可以将Flash小程序插入Facebook墙上帖子。我认为如果不制作FB应用程序,这是不可能的。

我知道FB会将链接转换为各种媒体类型 - 例如MP3的链接自动变为SWF MP3播放器,但使用的Flash小程序由FB的内部逻辑选择,而不是由帖子的内容选择。是否可以嵌入您自己选择的SWF小程序

由于我还没有找到任何关于此的文件,还有其他人吗?或者,你有一些PoC代码吗?

2 个答案:

答案 0 :(得分:3)

你可以使用Facebook的JS-SDK:

     FB.ui(
       {
         method: 'feed',
         name: 'Title pf post',
         link: 'http://link.to.target',
         picture: 'http://link.to.previewimage',
         source: 'http://link.to.swf',
         caption: 'Subtitle',
         description: 'Maintext',
       },
       function(response) {
         if (response && response.post_id) {
           //alert('Post was published.');
         } else {
           //alert('Post was not published.');
         }
       }
     );

答案 1 :(得分:2)

正如你在other question的评论中所说,你也对如何将参数传递给swf感兴趣,这是解决方案:

在javascript中

function postOnWall(fbuid) {
    var params = {};
    params['message'] = "my message";
    params['name'] = "my name";
    params['description'] = "my description";
    params['link'] = "https://www.mylink.com";
    params['caption'] = "my caption";
    params['picture'] = "https://www.mylink.de/thumb.png";
    params['source'] = "https://www.mylink.de/Main.swf" + "?bla=thisisyourdynamicquerystring";

    FB.api('/' + fbuid + '/feed', 'post', params, function(response) {
        if (!response || response.error) {
            // Error occured while publishing to stream
        } else {
            // Published to stream
        }
    });
}

in actionscript

public function Main() {    
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
}

private function loaderComplete(event : Event) : void {
    var myQueryStrings : Object = this.loaderInfo.parameters;
    if (myQueryStrings && myQueryStrings.bla) {
        _myMovie.label.text = myQueryStrings.bla;
    }
}