简体   繁体   English

Unity3d Webplayer hideFlashCallback

[英]Unity3d Webplayer hideFlashCallback

I have a game running inside Facebook and I'm trying to hide the game window when a user clicks on their search bar, friends, notifications or messages. 我有一个在Facebook上运行的游戏,当用户单击其搜索栏,朋友,通知或消息时,我试图隐藏游戏窗口。 I've looked into Facebook's Javascript API and they have this "hideFlashCallback" delegate you can set in FB.init(). 我已经研究了Facebook的Javascript API,并且它们具有可在FB.init()中设置的“ hideFlashCallback”委托。 However it doesn't seem like the callback is being hit. 但是,似乎回调没有被击中。 The alert(state) doesn't get called. 警报(状态)不会被调用。

<body>
    <div id="fb-root"></div>
    <script>
     window.fbAsyncInit = function() {
     FB.init({
      appId      : '<?php echo $config->app_id; ?>',
      channelUrl : '<?php echo $config->app_host; ?>/channel.html',
      status     : true,
      xfbml      : true,
      frictionlessRequests : true,
      hideFlashCallback : function(params) {
          var state = params.state;
          alert(state);
          }
      });
     };

     (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/all.js";
     fjs.parentNode.insertBefore(js, fjs);
     }(document, 'script', 'facebook-jssdk'));
    </script>
    <center>
        <div id="unityPlayer">
           <div class="missing">
             <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
              <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
             </a>
           </div>
        </div>
    </center>
</body>

所以我在我的unityPlayer div上添加了一个虚拟对象,它现在似乎可以正常工作。

<object width="1" height="1" id="facebookFakeFlash" align="middle" type="application/x-shockwave-flash"></object>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM