When my Flash website loads, it freezes halfway through the initial animation for 2-3 seconds and then continues. This obviously doesn’t look great and I can’t figure out what is causing it. Am thinking it is one of the scripts in index.html and have tried all sorts of ways to correct it – what am I doing wrong?
<!DOCTYPE html>
<html lang="en">
<head>
<title>company name</title>
.
.
.
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/flashobject.js"></script>
<!--[if lt IE 7]>
<link href="ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<header>
<hgroup>
<h1>company</h1>
<h2>company</h2>
</hgroup>
</header>
<div id="container">
<div id="head">
<div class="aligncenter"><a href="http://www.adobe.com/go/EN_US-H-GET-FLASH">
<img src="http://www.adobe.com/images/shared/download_buttons/get_adobe_flash_player.png" alt="" /></a>
</div>
</div>
</div>
<div class="g-plus" data-href="https://plus.google.com/100925740920754223119?rel=publisher" data-width="170" data-height="69" data-theme="light">
</body>
<!-- Flash -->
<script type="text/javascript">
var fo = new FlashObject("main_v10.swf", "head", "100%", "100%", "8", "");
fo.addParam("quality", "high");
fo.addParam("allowFullScreen", "true");
fo.write("head");
</script>
<!-- Hello Bar -->
<script type="text/javascript" src="//www.hellobar.com/hellobar.js"></script>
<script type="text/javascript">
new HelloBar(39040,52484);
</script>
<!-- GPlus -->
<script type="text/javascript">
window.___gcfg = {lang: 'en'};
(function()
{var po = document.createElement("script");
po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(po, s);
})();</script>
<!-- Google -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_setSiteSpeedSampleRate', 10]);
_gaq.push(['_trackPageview']);
(function init() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,s);
})();
window.onload = init;
</script>
</html>
Try removing the Hello Bar part to see if it changes something.
If it does, either the script in the file linked is ridiculously slow, or the server on which the script is is ridiculously slow. And since script loading and executing is blocking, it might be the source of the freeze.
In this case, you could try with defer or async attributes on the script tag but then you would need to rewrite
as
This way, when you script loads, HelloBar gets overwritten, the “loop” stops and your script is invoked with the correct values.