hoppl
06-25-2007, 02:29 PM
OK, I'll try to explain what I want to achieve:
I have a website, where all the page load the same SWF header, but I want the SWF to start at a different frame depending of the variable added to the URL. So I need to pass a variable from the URL to the SWF, and then use IF ELSE IF in my flash to detect the variable and go to the appropriate frame...
I've got this bit of code so far, it works just fine, but it reloads the same swf every time, even if it's already cached, since there is a new variable appended to the filename...
<script language="JavaScript" type="text/javascript">
<!-- //==============================================
var QueryString = document.location.href;
if (!QueryString) QueryString = document.location;
QueryString = QueryString.indexOf("?") != -1 ? QueryString.substring(QueryString.indexOf("?"), QueryString.length) : "";
function writeFlash() {
var l1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="770" height="140">'
var l2 = '<param name="movie" value="entete.swf'+QueryString+'" />'
var l3 = '<param name="quality" value="high" />'
var l4 = '<embed src="entete.swf'+QueryString+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="770" height="140"></embed>'
var l5 = '</object>'
document.write(l1+l2+l3+l4+l5)
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
writeFlash();
//-->
</script>
So after some research I found out about FlashVars, which supposedly would send the variable to flash without adding a variable to the filename. So I tried to simply move the 'Querystring' from the filename to a new param, etc... But it doesn't work at all...
So any idea why the same code but with:
In the object tag: <param name="FlashVars" value="'+QueryString+' />
In the embed tag: FlashVars="'+QueryString+'"
...doesn't work.?
I have a website, where all the page load the same SWF header, but I want the SWF to start at a different frame depending of the variable added to the URL. So I need to pass a variable from the URL to the SWF, and then use IF ELSE IF in my flash to detect the variable and go to the appropriate frame...
I've got this bit of code so far, it works just fine, but it reloads the same swf every time, even if it's already cached, since there is a new variable appended to the filename...
<script language="JavaScript" type="text/javascript">
<!-- //==============================================
var QueryString = document.location.href;
if (!QueryString) QueryString = document.location;
QueryString = QueryString.indexOf("?") != -1 ? QueryString.substring(QueryString.indexOf("?"), QueryString.length) : "";
function writeFlash() {
var l1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="770" height="140">'
var l2 = '<param name="movie" value="entete.swf'+QueryString+'" />'
var l3 = '<param name="quality" value="high" />'
var l4 = '<embed src="entete.swf'+QueryString+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="770" height="140"></embed>'
var l5 = '</object>'
document.write(l1+l2+l3+l4+l5)
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
writeFlash();
//-->
</script>
So after some research I found out about FlashVars, which supposedly would send the variable to flash without adding a variable to the filename. So I tried to simply move the 'Querystring' from the filename to a new param, etc... But it doesn't work at all...
So any idea why the same code but with:
In the object tag: <param name="FlashVars" value="'+QueryString+' />
In the embed tag: FlashVars="'+QueryString+'"
...doesn't work.?