Normally on one html page we place only one flash demo. But sometime, we have more than one video demo for one product, for example, we have 100 videos, so it is obviously we can not build 10 pages for each of them. Is their any easy way we can put them on one page with a index that visitor can select and switch between them?
Using a dynamic page will be easy to do such a job, but a static HTML page could be better. Is that possible? The answer is yes, for example,
http://www.stepok.net/eng/tutorials.htm?SWF=rc_compose&width=640&height=574
The above page has 7 videos created by SCREEN2SWF, an index link lying on right of the page. It is an html page but receive parameters from URL. If this is what your need, the following article will show you how to do this.
First we need a JavaScript file named swfobject.js which can create flash object dynamically.
It is an open source JavaScript under MIT license, you can get it at:
http://blog.deconcept.com/swfobject/
With this script file, we have to add some code on the page,
First, a function between <HEAD> and </HEAD>
<script type="text/javascript">
function getQueryString(name)
{
if(location.href.indexOf("?")==-1 || location.href.indexOf(name+’=')==-1)
{ return ”; }
var queryString = location.href.substring(location.href.indexOf("?")+1);
var parameters = queryString.split("&");
var pos, paraName, paraValue;
for(var i=0; i<parameters.length; i++)
{
pos = parameters[i].indexOf(’=');
if(pos == -1) { continue; }
paraName = parameters[i].substring(0, pos);
paraValue = parameters[i].substring(pos + 1);
if(paraName == name)
{ return unescape(paraValue.replace(/\+/g, " ")); }
}
return ”;
};
</script>
Then, at the place you want to show the flash,
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject('<path>' + getQueryString("SWF") + '.swf', "swffile", getQueryString("width"), getQueryString("height"), "9,0,124,0", "#000000");
so.write("flashcontent");
// ]]>
</script>
Assume this html is
http://www.yourwebsite.com/showflash.htm,
now you upload your SWF file to the folder in ‘<path>’, for example path could be ‘tutorial/’, now you have a video named “awf”, with widh=500,height=350. The you upload to :
http://www.yourwebsite.com/tutorial/a.swf
After that, the link for this swf file is,
http://www.yourwebsite.com/showflash.htm?SWF=a&width=500&height=350
And when visit the above URL, the navigator will automatically load the “a.swf” with right size. Now you can upload the rest of other videos, just changing the parameters can visit each of them.
The size is important, remember to set it right. It is controlled by SCREEN2SWF-Save-Flash setup dialog.