Embedding Flash Content on a Rails App
Recently I've been trying to write a post about the use of toolbars with a Flex application. The post is coming along slowly, almost there as I write this, but I had a problem embedding the Flex app. within my blog post.
Essentially the embedded Flash object (.SWF file) wasn't appearing on my blog page.
My hosting company is DreamHost and so I had a quick look at the DreamHost wiki and forum but couldn't really find anything related to my specific problem. Of course it doesn't help when you're trying to search when there's a Ruby on Rails command named 'flash'!
I played around with my local copy of my web site and got the Flash content working after a short while. I uploaded the code to my site but the hosted site was still not working.
At some point I stumbled upon a forum where someone's advice was to take a look at the error.log file on the server; this forum post was unrelated to my Flash problem but it gave me a vital clue. I then viewed the error.log file on my host server and discovered that the attempt to fetch my .SWF file was failing due to a 'Permission denied' error. At this stage I was thinking that the permissions at the location at which I had stored by .SWF file were preventing my browser from accessing this content, and I was right.
After issuing a 'chmod 755 public/images/*' command everything began to work. Here's the HTML code that I used to embed my Flash/Flex content:
1: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
2: WIDTH="400" HEIGHT="400">
3: <PARAM NAME="movie" VALUE="/images/ToolbarDemo.swf">
4: <!--[if !IE]>-->
5: <object type="application/x-shockwave-flash"
6: data="/images/ToolbarDemo.swf" width="400" height="400">
7: <!--<![if !IE]-->
8: <p>Flex demo of toolbar</p>
9: <!--[if !IE]>-->
10: </object>
11: <!--<![endif]-->
12: </object>
Posted by Graham Blake on 7th June 2009 at 05:17