2011-05-24 34 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

相关问题