Fail to display 2 instances of the same swf with different flashvars.

2 views
Skip to first unread message

xauss

unread,
May 16, 2008, 5:44:32 PM5/16/08
to SWFObject

I think this should work, but it doesn't. It only shows the second
instance. I use two different divs, two different flashvars objects,
and reference these in two different calls to embedSWF:

<div id="mp3_1">
Problem loading flash content.
</div>
<div id="mp3_2">
Problem loading flash content.
</div>
<script>
//<![CDATA[
var mp3_1_flashvars = {
path:"http://cdn.sfgate.com/blogs/sounds/sfgate/chroncast/2008/05/15/
LaSalle-AskMick-20080516.mp3&dur=31:39&auto=false"
};
var mp3_2_flashvars = {
path:"http://cdn.sfgate.com/blogs/sounds/sfgate/chroncast/2008/05/06/
OpenMic-Poems-20080507.mp3&dur=3:42&auto=false"
};

var mp3params = {
bgcolor:"#ffffff",
quality:"high",
allowscriptaccess:"always"
};
var mp3attr = {
styleclass:"mp3onlineplayer"
}
swfobject.embedSWF("http://imgs.sfgate.com/g/players/
inline_player.swf", "mp3_1", "220", "19", "6.0.0", false,
mp3_1_flashvars, mp3params, mp\
3attr);
swfobject.embedSWF("http://imgs.sfgate.com/g/players/
inline_player.swf", "mp3_2", "110", "19", "6.0.0", false,
mp3_2_flashvars, mp3params, mp\
3attr);
//]]>
</script>


Here's what the generated code reads. There are problems there:
1) both objects have the same id (not valid xhtml)
2) the param with name flashvars gets a concatenation of the two
different flashvars.

<object style="visibility: visible;" id="mp3_1" data="http://
imgs.sfgate.com/g/players/inline_player.swf" class="mp3onlineplayer"
type="application/x-shockwave-flash" height="19" width="110"><param
value="#ffffff" name="bgcolor"><param value="high"
name="quality"><param value="always" name="allowscriptaccess"><param
value="path=http://cdn.sfgate.com/blogs/sounds/sfgate/chroncast/
2008/05/15/LaSalle-
AskMick-20080516.mp3&amp;dur=31:39&amp;auto=false&amp;path=http://
cdn.sfgate.com/blogs/sounds/sfgate/chroncast/2008/05/06/OpenMic-
Poems-20080507.mp3&amp;dur=3:42&amp;auto=false" name="flashvars"></
object>
<object id="mp3_1" data="http://imgs.sfgate.com/g/players/
inline_player.swf" class="mp3onlineplayer" type="application/x-
shockwave-flash" height="19" width="110"><param value="#ffffff"
name="bgcolor"><param value="high" name="quality"><param
value="always" name="allowscriptaccess"><param value="path=http://
cdn.sfgate.com/blogs/sounds/sfgate/chroncast/2008/05/15/LaSalle-
AskMick-20080516.mp3&amp;dur=31:39&amp;auto=false&amp;path=http://
cdn.sfgate.com/blogs/sounds/sfgate/chroncast/2008/05/06/OpenMic-
Poems-20080507.mp3&amp;dur=3:42&amp;auto=false" name="flashvars"></
object>

Bobby

unread,
May 23, 2008, 4:41:02 AM5/23/08
to SWFObject
The issue has been fixed. For the complete resolution, please read
issue reports:
http://code.google.com/p/swfobject/issues/detail?id=90
http://code.google.com/p/swfobject/issues/detail?id=91
Reply all
Reply to author
Forward
0 new messages