2011-05-24 41 views
-1

我創建了一個Facebook應用程序和登錄加載,但一旦它,我得到一個空白屏幕。它看起來像我的瑞士法郎沒有加載。這是我的index.php文件:如何在Facebook上獲得swf?

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
    <head> 
    <!-- Include support librarys first --> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> 
    <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 

    <script type="text/javascript"> 

     var APP_ID = "my_id"; 
     var REDIRECT_URI = "my_url"; 
     var PERMS = "publish_stream, user_photos"; //comma separated list of extended permissions 

     function init() 
     { 
     FB.init({appId:APP_ID, status: true, cookie: true}); 
     FB.getLoginStatus(handleLoginStatus); 
     } 

     function handleLoginStatus(response) 
     { 
     if (response.session) { //Show the SWF 

      swfobject.embedSWF("main.swf", "flashContent", "640", "480", "9.0", null, null, null, {name:"flashContent"}); 

     } else { //ask the user to login 

      var params = window.location.toString().slice(window.location.toString().indexOf('?')); 
      top.location = 'https://graph.facebook.com/oauth/authorize?client_id='+APP_ID+'&scope='+PERMS+'&redirect_uri=' + REDIRECT_URI + params; 
     } 
     } 
     $(init); 
    </script> 
    </head> 
    <body> 
    <div id="fb-root"></div> 
    <div id="ConnectDemo"></div> 
    </body> 
</html> 

是否有任何理由,這不會工作?

+1

和您的應用程序鏈接? (以便我們可以通過螢火蟲進行檢查) – 2011-05-24 17:39:12

回答

2

swfobject.embedSWF的第二個參數需要是要注入SWF的元素的id。您使用的是flashContent,它不存在於您的DOM中?

+0

如果這確實是答案,那麼在發佈到StackOverflow之前,應該先完成這個調試步驟。在你耗盡了其他選項之後,SO應該作爲最後的手段。 – Nick 2011-05-24 17:57:58

相關問題