2011-12-15 77 views
1

this question的評論中,用戶評論說可以將Flash小程序插入Facebook牆貼。如果沒有製作FB應用程序,我覺得這是不可能的。如何在Facebook上發佈Flash小程序到牆上?

我知道FB會將鏈接轉換爲各種媒體類型 - 例如,到MP3的鏈接自動成爲SWF MP3播放器,但所使用的Flash小程序由FB的內部邏輯選擇,而不是由帖子的內容選擇。是否可以嵌入您自己選擇的SWF小程序

由於我還沒有找到任何關於此的文檔,有沒有其他人?或者,您是否有一些PoC代碼可以做到這一點?

+0

據稱,這已經在SO這裏回答,所以這可能是一個重複的問題;唉,我的搜索技能使我在這裏(以及在整個互聯網上)失敗。 – Piskvor 2011-12-15 08:58:36

回答

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

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

糟糕的措辭選擇...... JS-SDK的意思是。請參閱https://developers.facebook.com/docs/reference/javascript/和特殊的https://developers.facebook.com/docs/reference/javascript/FB.ui/ – Rufinus 2011-12-15 09:16:23