Flash/SWF/FLV embedding problem (Controls and Skin)
Are you having a problem with embedding of flash files on your site, where the controls/skin isn’t showing, but they do show if you access the SWF directly?
I am not a big fan of Flash. And I have never used it on any of my websites. Unfortunately though, I have been redesigning a website for a friend which has forced me into this realm of Flash Frustration™. There are about 400 flash videos on this site, so it is impossible to convert them to an alternate format.
Basically the site was completely static, and maintenance was time consuming. So I am changing it to be dynamic (database driven ASP). Each SWF file has a skin, which allows controls like Play and Stop etc. The problem is when you are using an ASP page to load content from a database, that asp file exists once, to load all content (of the specific type). Therefore you cut out having to have 1 htm file for each SWF file. Sounds great. However, in all of Adobe’s brilliance they decided that you have to have the SWF(skin and controls/loader), FLV (actual video) and HTM (with the EMBED code) in the same folder. This is just dumb. Anyway, one solution would have been to copy all the SWF and FLV files to one folder (the folder where the ASP file was). This would be a nightmare!
I had to find a workaround. I have been google’ing for the past 3 hours on this issue. Unfortunately, all that did was confirm the fact that the files all need to be in the same place. I needed to somehow make the swf/flv files think that they were being called from the same folder. I looked up methods of URL rewriting. That didn’t help much.
Solution
I then pulled back from the problem and though of something. iFrames! Yep, that simple. It works flawlessly. You don’t have to have a dynamic page (ASP or PHP), you could just use a plain old HTML file.
So, lets say you have a SWF file: \media\movies_action\themovie.swf
You have an HTML page in folder: \main\
If you try the traditional <embed>/<object> method, the file will probably play, but you won’t have any controls or skin.
So instead…inside the html file, just put this code :
<iframe src=”\media\movies_action\themovie.swf” frameborder=”0″ width=”400px” height=”300px”> </iframe>
This will create a 400×300 pixel iframe which has the flash file playing, with all the controls in place! Easy. Let me know if this helped you out.
April 20th, 2008 at 11:48 pm
been stuck trying to find a solution to this for ages. such a simple solution….thank you!
May 27th, 2008 at 10:02 am
Fucking AWESOME! Great solution!!!