PDA

View Full Version : flashobject (embed) javascript & FlashVars



pixedout
May 12th, 2006, 03:23 PM
Hi,

I was hoping someone could give me a hand with this code. I'm using the kirupa flashobject.js to switch over some of my old flash object embeds. It works fine on all my .swfs except this one where I pass in flashvars. I'm a little confused on how I should attempt this. I tried the straight up way of adding a "fo.addParam()" but it didn't work. Anyway, I've included the pre-changed flash object as well as the javascript version that I tried to convert it to. Any suggestions would rock my world.
---------------------------------------------------------
//ORIGINAL CODE

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="120" height="300">
<param name="movie" value="flash/navigation.swf">
<param name=FlashVars value="id=<%=Session("category")%>">
<param name="quality" value="high">
<embed src="flash/navigation.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="120" height="300" FlashVars="id=<%=Session("category")%>"></embed>
</object>

---------------------------------------------------------
//JAVASCRIPT VERSION


<script type="text/javascript" src="flashobject.js"></script>
<div id="flashcontent_text" style="width: 120; height: 300"></div>
<script type="text/javascript">
var fo = new FlashObject("flash/navigation.swf", "animationName", "120", "300", "8", "#4d4c4c");
fo.addParam("allowScriptAccess", "sameDomain");
fo.addParam("quality", "high");
fo.addParam("scale", "noscale");
fo.addParam("loop", "false");
fo.addParam("FlashVars", "id=<%=Session("category")%>");
fo.write("flashcontent_text");
</script>

PCGamre
May 12th, 2006, 08:19 PM
I'd like to know the answer too, cause if it works, why not. It doesn't work for me either, so I use js.



window.onload = function() {
window.document.flashName.SetVariable("varInsideFlash", value)
}

Jim Nayzium
June 7th, 2006, 08:47 PM
i just read the js file and it says

fo.addVariable ... i used addVariable instead of addParams it worked...

but now I cannot make it work for more than one swf loaded on the page...

the first shows up , hte others don't ... I am sure it is user error, but oh well

igby
June 26th, 2006, 07:56 PM
I'm having a similar problem, so I thought I'd push this one up and see if anyone else has figured out the best solution.

Here's my code:
AS on first frame:
if (showLogo == "no") {
fade._visible = false;
fade._alpha = 0;
l.loadBar._visible = false;
l.loadBar._alpha = 0;
}

HTML:
document.write(
'<script type="text/javascript">\n'+
'var fo = new SWFObject("newLogo.swf", "animationName", "100%", "100%", "8", "#ffffff")\n'+
'fo.addParam("allowScriptAccess", "sameDomain")\n'+
'fo.addParam("FlashVars", "allowResize='+e+'")\n'+
'fo.addParam("FlashVars", "showLogo=no")\n'+
'fo.addParam("FlashVars", "jump=judeika")\n'+
'fo.addParam("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash")\n'+
'fo.addParam("quality", "high")\n'+
'fo.addParam("scale", "noscale")\n'+
'fo.addParam("wmode", "transparent")\n'+
'fo.write("flashcontent")\n'+
'</script>\n');

The other 2 "FlashVars" work fine, but the "showLogo=no" is not working.

Any help would be beautiful.

Igby