466 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Has been part of the Envato Community for over 6 years
+7 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.

5397 posts
  • Has sold $750,000+ on Envato Market
  • Helps us moderate the forums
  • Won a competition
  • Has been part of the Envato Community for over 6 years
+20 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
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Has been part of the Envato Community for over 6 years
+7 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.

5397 posts
  • Has sold $750,000+ on Envato Market
  • Helps us moderate the forums
  • Won a competition
  • Has been part of the Envato Community for over 6 years
+20 more
dtbaker
Moderator
says

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

466 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Has been part of the Envato Community for over 6 years
+7 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");

by
by
by
by
by
by