I wanted to share my experiences in installing a flash banner into the header of my WordPress site. It took me forever to figure out, and i’ve found that the fantastic WordPress and Internet community in general has been great about sharing information, however I had difficulty in finding ALL of this info in one place.
So I thought I’d do my part and lend a hand to my fellow aspiring WordPress developers out there.
You can view a sample of the flash banner here:
https://www.martyandcarrie.com/wedding
Here is the code I put into my header.php file within the <body>
You can copy this code exactly and customize it for your needs.
<h1 id="header">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="755" height="265" id="MCFLashBanner" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="https://www.martinzager.com/mcflash7.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="https://www.martinzager.com/mcflash7.swf" quality="high" bgcolor="#ffffff" width="755" height="265" name="MCFLashBanner" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />
</object>
<?php /*?><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a><?php */?></h1>
You’ll notice that I commented out at the bottom the WordPress function call for the URL and name of the blog.
Everything that’s in the <object> tag was generated by Flash… you can generate all of that code from your own Flash FLA file just by going to File >> PUBLISH (in Flash) and making sure you have an HTML file checked in your ‘PUBLISH SETTINGS’. Check the HTML file and within it, you’ll see the exact <object> info you’ll need to paste into your header.php file.
The ‘header’ class is defined in my Stylesheet CSS file:
You can copy this code exactly and customize it for your needs.
#header {
background-repeat: no-repeat;
margin: 0px;
text-align: left;
vertical-align: bottom;
height: 264px;
}
The last and final trick.
The biggest problem I had when loading a flash banner is that it ALWAYS REPEATED. I did not want the flash banner to repeat at all,… only after a certain amount of time did I want the banner to repeat or replay.
HERE IS THE SOLUTION:
You need to put some ActionScript within the first frame of your Flash FLA timeline.
Here is the Flash ActionScript for making it so your flash banner will NOT repeat for 85 seconds.
You can copy this code exactly and customize it for your needs.
stop();
var today = new Date();
var so:SharedObject = SharedObject.getLocal("time");
var period = 85000;
if (loaded == total) {
if (!((_root.today - _root.so.data.val)<_root.period)) {
_root.so.data.val = _root.today;
_root.so.flush();
banner3.gotoAndPlay(1);
} else {
_root.so.data.val = _root.today;
_root.gotoAndPlay(3);
}
}
What that code does basically is say that if the flash banner has not been loaded before in someone’s browser, then it will play the whole movie clip within the Flash file (called ‘banner3’)
And if the flash banner HAS been loaded within the last 85 seconds (flash reads milliseconds, hence the 85000), then the playhead will jump to frame 3 of the timeline, which is just a still image of the banner without audio.
This makes it, so the viewer is not constantly having to see the same annoying flash banner over and over and over…
I hope this was helpful. I can’t really offer much support info other than this, but perhaps it will lead you in the write direction.
Happy wordpressing!