所以我为我的flash游戏制作了一个自定义预加载器。我使用swfObject库嵌入Flash游戏。
预加载器出现在Firefox,Chrome和IE7-10中,但它并没有出现在IE11中。它显示一个白色的屏幕,直到游戏加载,Flash游戏正在接收参数OK并且回调函数告诉flash对象被创建(在IE11中它是在白屏启动时创建的)。我已经尝试将IE11用户代理更改为其他IE,但它没有用。
Javascript代码:(swfObject)
<script type="text/javascript">
var flashvars = {};
flashvars.idSessao = "<?php echo $idSessao; ?>";
flashvars.sessionPHP = "<?php echo session_id(); ?>";
flashvars.lingua = "pt";
var params = {};
params.menu = "false";
params.wmode = "transparent";
params.allowFullScreen = "true";
params.allowScriptAccess = "always";
params.type = "application/x-shockwave-flash";
params.pluginspage = "http://www.macromedia.com/go/getflashplayer";
params.bgcolor = "#FFFFFF";
var attributes = {};
attributes.id = "as3_js";
attributes.name = "jogo";
attributes.align = "middle";
swfobject.embedSWF('jogos/novo<?php echo $rowPresGame['GameRefID']; ?>.swf', 'flash', '900', '600', '9.0.0', false, flashvars, params, attributes,swfCallback);
function swfCallback( event )
{
console.log(event.success);
}
</script>
AS3代码
loadGame()
function loadGame()
{
loadbar.visible = false;
lang = root.loaderInfo.parameters.lingua;
idSession = root.loaderInfo.parameters.idSessao;
phpSession = root.loaderInfo.parameters.sessionPHP;
addEventListener(Event.ENTER_FRAME, loadGameProgress);
}
function loadGameProgress(e:Event):void
{
var totalload = loaderInfo.bytesTotal;
var currentload = loaderInfo.bytesLoaded;
loadbar.scaleX = currentload/totalload
loadbar.visible = true;
if (loaderInfo && currentload == totalload)
{
this.removeEventListener(Event.ENTER_FRAME, loadGameProgress);
play();
}
}
提前致谢