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.
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
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.
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.
- Grew a moustache for the Envato Movember competition
- Community Moderator
- Contributed a Blog Post
- Author was Featured
- Item was Featured
- Won a Competition
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 4-5 years
Probably best to give a link to the problem page so others can debug/firebug the problem.
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");
