Having problems with multiple flashvars in wordpress

20 views
Skip to first unread message

chieffan

unread,
Nov 17, 2009, 4:27:52 PM11/17/09
to SWFObject
I have searched on here and it seems what I am doing is right, but
it's not working.

In the header.php of my Wordpress site, in the <head> section, I have
something like this after my call of the swfobject:

<script type="text/javascript">

var flashvars = {};
flashvars.level = "<?php ;echo $level;?>";
flashvars.score = "<?php echo $score;?>";
swfobject.embedSWF("mydomain/externalflash.swf", "externalflash",
"760", "360", "9.0.0","expressInstall.swf",flashvars);

</script>


<script type="text/javascript">

var flashvars2 = {};
flashvars.level2 = "<?php ;echo $level2;?>";
flashvars.score2 = "<?php echo $score1;?>";
swfobject.embedSWF("mydomain/externalflash2.swf", "externalflash2",
"760", "360", "9.0.0","expressInstall.swf",flashvars2);

</script>

My problem is the second swf shows but the flash vars dont pass. I
have put the number 2 next to the flashvars and tried without. It
only displays the movie without the data.

I am using swfobject 2 on this. Anyone have any suggestions?

In Wordpress, I then call it via <div id="externalflash2">alternate
content</div>

Any ideas?

Thanks.

Sam Sherlock

unread,
Nov 17, 2009, 5:14:51 PM11/17/09
to swfo...@googlegroups.com
in the following I am declaring a single var for flashvars and reseting it between calls to embedswf

<script type="text/javascript">
var flashvars = {};
flashvars.level = "<?php ;echo $level;?>";
flashvars.score = "<?php echo $score;?>";
swfobject.embedSWF("mydomain/externalflash.swf", "externalflash",
"760", "360", "9.0.0","expressInstall.swf",flashvars);

flashvars = {};

flashvars.level2 = "<?php ;echo $level2;?>";
flashvars.score2 = "<?php echo $score1;?>";
swfobject.embedSWF("mydomain/externalflash2.swf", "externalflash2",
"760", "360", "9.0.0","expressInstall.swf",flashvars);

</script>

- S



Aran Rhee

unread,
Nov 17, 2009, 5:52:23 PM11/17/09
to swfo...@googlegroups.com
Have a santiy check of your code on the 2nd flashvars object:

var flashvars2 = {};

flashvars.level2 = "<?php ;echo $level2;?>";
flashvars.score2 = "<?php echo $score1;?>";

You are creating "flashvars2", then adding two variables to a different (the original) "flashvars" object :)


BTW, you don't need separate <script> tags between your declarations.


Aran

--

You received this message because you are subscribed to the Google Groups "SWFObject" group.
To post to this group, send email to swfo...@googlegroups.com.
To unsubscribe from this group, send email to swfobject+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swfobject?hl=.

chieffan

unread,
Nov 18, 2009, 9:49:14 AM11/18/09
to SWFObject
I figured out my problem.

I was also adding the number of the Flash Var to the passing value

var flashvars2 = {};
flashvars.level2 = "<?php ;echo $level2;?>";

so it should have been

var flashvars2 = {};
flashvars.level = "<?php ;echo $level2;?>";


Thanks for the help.

Sam Sherlock

unread,
Nov 18, 2009, 9:51:34 AM11/18/09
to swfo...@googlegroups.com
then this is not being used

var flashvars2 = {};
 
- S



2009/11/18 chieffan <rodand...@gmail.com>

Aran Rhee

unread,
Nov 18, 2009, 5:06:27 PM11/18/09
to swfo...@googlegroups.com
Review #2 - you want:


var flashvars2 = {};
flashvars2.level = "<?php ;echo $level2;?>";


Aran
Reply all
Reply to author
Forward
0 new messages