466 posts
  • Has been part of the Envato Community for over 5 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+5 more
uiuxaesthetics says

Ok question for you html rockstars.

Doing a custom html project for a client and I am getting a conflict with jquery and swfObject.

Here is what happens.

I pass some video dimensions to javascript and resize and position a div with jquery, no biggie. But then right after that I call a function that embeds a swf with swfObject. It totally ignores the new width and height I gave the div with jquery and uses the original dimensions of the div from the .css file.

Anyone run into anything like this before.

3310 posts
  • Provided great contribution to our forums
  • Nominated Community Superstar of the month
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
+18 more
dtbaker Moderator says

Try using swfobject.embedSWF (search for it on this page http://code.google.com/p/swfobject/wiki/documentation )

You can pass the width/height of the SWF file into embedSWF

That way you shouldn’t need to resize the surrounding div with jQuery beforehand.

466 posts
  • Has been part of the Envato Community for over 5 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+5 more
uiuxaesthetics says

Yup that is what I am doing

swfobject.embedSWF("videoPlayer.swf", "VideoArea", videoWidth, areaHeight, "9.0.0", false, flashvars, params, attributes);

This works fine, but when swfObject embeds the video into the div it uses the old div dimensions set in the .css file and not the new dimensions updated by jQuery before the object embed.

3310 posts
  • Provided great contribution to our forums
  • Nominated Community Superstar of the month
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
+18 more
dtbaker Moderator says

Probably best to give a link to the problem page so others can debug/firebug the problem.

466 posts
  • Has been part of the Envato Community for over 5 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
+5 more
uiuxaesthetics says

I figured it out in case anyone else has had the same issue.

For some reason if I would resize / reposition the div and then use swfObject to embed the swf swfObject would use the old div dimensions.

This doesn’t work
$("#VideoArea").css('left',nuX);
$("#VideoArea").width(videoWidth);
$("#VideoArea").height(areaHeight);
$("#VideoArea").css("visibility","visible");

swfobject.embedSWF("videoPlayer.swf", "VideoArea", '100%', '100%', "9.0.0", false, flashvars, params, attributes);

This does work


swfobject.embedSWF("videoPlayer.swf", "VideoArea", '100%', '100%', "9.0.0", false, flashvars, params, attributes);
$("#VideoArea").css('left',nuX);
$("#VideoArea").width(videoWidth);
$("#VideoArea").height(areaHeight);
$("#VideoArea").css("visibility","visible");

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by