Just hit a snag with a jQuery dialog overlay which was supposed to display over an embedded Flash file — whatever the z-index of the dialog, it always appeared behind the movie (and flickered insanely which was doubly annoying). Thankfully, it’s easy to fix this problem with the addition of an extra parameter in your embed code:
Archive for the ‘flash’ Category
JQuery dialogs and embedded Flash movies
Wednesday, December 9th, 2009Plone and Flash Player 10: Opera’s revenge
Thursday, October 30th, 2008I got round it with a bit of old-fashioned browser detection. Basically, Opera’s quite happy to have the content-disposition header left alone, so I needed a direct path to the Flash file for Opera and a path that took in my header setting script for everyone else:
if (navigator.userAgent.indexOf('Opera')>-1) {
swfurl = '&dtml-portal_url;/path/to/flash/myflash.swf' } else {
swfurl = '&dtml-portal_url;/path/to/flash/showflash?flashvid=myflash.swf'
}
swfobject.embedSWF(swfurl, "my-dom-id", "435", "290", "9.0.115");
Not sure why Opera should behave differently to other browsers here.
Plone and Flash Player 10
Friday, October 17th, 2008The lovely folks at SWFObject helped to identify why this was happening — nothing to do with SWFObject at all but the fact that Flash Player 10 implements some new security “features”. I managed to isolate it to the fact that Plone serves up ATFiles with the header, “Content-Disposition: attachment”. Flash Player 10 ignores files served up with this header, so you need to override this and set it to “Content-Disposition: inline;”.
I came up with this solution which may not be overly elegant but at least it works. I created a skin-level Python script that sets response headers before returning the file:
showflash.py
request = container.REQUEST
RESPONSE = request.RESPONSE
flashvid = request['flashvid']
cd = 'inline; filename=%s' %(context.id)
RESPONSE.setHeader('Content-Disposition', cd)
return context[flashvid]
Then, when I embed the video with SWFObject I call it thus,
<script type="text/javascript">
swfobject.embedSWF("&dtml-portal_url;/path/to/flash/showflash?flashvid=myflash.swf", "my-dom-id", "435", "290", "9.0.115");
</script>
This may be better handled by a product like Plone4Artists Video but it certainly works as a fix for us.