Hello,
I've read the tutorials and posts at Adobe but can't get this to work. My url passes this to the page with my.swf movie:
Code:
http://www.etc/myswf.html?var1=3&var2=A
var1 and var 2 are set depending on the button pressed on the previous page.
This is what I have for the code on the page with my.swf - but it doesn't work. Any suggestions?
script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
html body etc ...
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
'width', '800',
'height', '600',
'src', 'myswf',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'myswf',
'bgcolor', '#ffcc00',
'name', 'myswf',
'menu', 'true',
'allowScriptAccess','sameDomain',
'movie', 'myswf',
'FlashVars', 'var1=var1&var2=var2',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600" id="myswf" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="myswf.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffcc00" />
<param name="FlashVars" value="var1=var1&var2=var2">
<embed src="my.swf" FlashVars="var1=var1&var2=var2" quality="high" bgcolor="#ffcc00" width="800" height="600" name="myswf" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
I have "var1=var1&var2=var2" this way because in myswf.fla movie I pick up var1 = var1 from the URL and var2 = var2.
The old method that I used with JavaScript worked but did not contain the AC_FL_RunContent code which is needed now for IE. I tried to combine the two methods but haven't had success yet.
<script language="JavaScript">
var1 = "some value"; // Set default values in case not set in URL
var2 = "another variable!";
var p=location.search.substring(1).replace(/\+/g,' ').split("&");
for(var i=0;i<p.length;i++){
v=p[i].split("=");
window[unescape(v[0]).toLowerCase()]=unescape(v[1]);
}
window.alert("var1=" + var1);
window.alert("var2=" + var2);
</script>
... and in the body
<script language="JavaScript">
document.write("<object><PARAM NAME=FlashVars VALUE=\"var1="+var1+"&var2="+var2+"\">");
document.write("<EMBED name=\"movie\" src=\"signSearch.swf\" ");
document.write("FlashVars=\"var1="+var1+"&var2="+var2+"\" ");
document.write("width=\"800\" height=\"600\" type=\"application/x-shockwave-flash\" ");
document.write("bgcolor=#ffcc00"); //Add any additional object parameters you may require such as bgColor, etc
document.write(" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"");
document.write("></EMBED></object>");
</script>
Thanks!
Charles
by: driscolltmPosted on 2007-11-07 at 20:20:29ID: 20239167
use swfobject instead :) just google it...