465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
CurtyCurt 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.

3047 posts
  • Located in Australia
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
  • Helped several times protecting Envato Market against copyright violations
+16 more
dtbaker Volunteer 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.

465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
CurtyCurt 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.

3047 posts
  • Located in Australia
  • Helps us moderate the forums
  • Has been part of the Envato Community for over 5 years
  • Helped several times protecting Envato Market against copyright violations
+16 more
dtbaker Volunteer moderator says

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

465 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+5 more
CurtyCurt 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");

by
by
by
by
by
by