If I used

  foreach($element['#flashvars'] as $parameter => $value) {
    $swf->flashVar($parameter, $value);
  }

then the flashvars don't get passed to the movie.

But if I assign an array of flashvars in the parameters

$swf->param('flashvars', $element['#flashvars']);

it works.

I'm not very good with jQuery, but I added a few alert boxes and the function to flatten the flashvars to a string is working, but the value doesn't seem to be processed when the parameters array is processed.

Comments

Stuart Greenfield’s picture

If I manually force the flashvars in by adding some code just after ie6hack=''; then it works ok.

      ie6hack = '';

      // Test - manually force this element in
      if (opts.params.flashvars) {
    	  var p = $('<param/>').attr('name', 'flashvars').attr('value', opts.params.flashvars);
    	  $.browser.msie ? ie6hack += p.parent().html() : p.appendTo(obj);
      }
Stuart Greenfield’s picture

Ah - this occurs ONLY if no other parameters are set on the movie. If I pass no other parameters, the flashvars are missing, but if I pass, say, 'play' => 'true' then the flashvars work. It looks like when the settings are constructed and there are no parameters then opts.params turns in to an empty string.

Adding

      // See if parameters are empty
      if (opts.params == '') {
    	  opts.params = {};
      }

just before

      opts.params.flashvars = formatVars(opts.flashvars);

seems to cure it.

mbutcher’s picture

Will this work instead?

      opts.params['flashvars'] = formatVars(opts.flashvars);

(jquery.swfembed.js: 86)

This should correctly initialize the params object.

Stuart Greenfield’s picture

Yes - that seems to work!

mbutcher’s picture

This will be in the dev build in the next 12 hours. It is available now in CVS.

Thanks for the patch!

Stuart Greenfield’s picture

It still didn't work on a new install - putting the

      // See if parameters are empty
      if (opts.params == '') {
          opts.params = {};
      }

back in fixed it again. I think on my previous test I was loading cached content.

Also, the fix has to go earlier in the code (I'm putting it at line 71) as IE tries to add to the params array too, so it gets hit with the same bug.

I've also noticed that on IE the page continuously shows itself as loading, even when the content appears. FF is fine though. Not sure why that is?

mbutcher’s picture

Alright. Thanks. I'll re-fix (perhaps later today) with your original change.

Matt

mbutcher’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.