Saturday, December 30, 2006, 02:41 AM - Actionscript, Javascript
It seems every time I try something new I need to fix other people's problems to get it to work, arrrrg! Here's the solution: SWFFormFix by me, Steve Kamerman :D. Here's the deal, basically, you need to trick Internet Explorer because if you put an object in a form, IE's implementation of Javascript seems to want to look for "window.yourObject" and not "document.form[x].yourObject", so my script figures out which form you are in and makes an alias at the wrong location that points to the right location. Don't believe me? Try it out.
Here are some examples:
A SWF outside of a FORM (using SWFObject to embed)
A SWF inside of a FORM (using SWFObject to embed)
A SWF inside of a FORM (using std Flash EMBED tags)
A SWF inside of a FORM (using SWFObject and SWFFormFix)
As you should see, SWFFormFix fixes the problem and leaves you with zero errors - plus it's free!
Download SWFFormFix:
http://devel.teratechnologies.net/swffo ... formfix.js
Usage:
1. Include the swfformfix.js script in the head of your document
<html>
<head>
<script type="text/javascript" src="swfformfix.js"></script>
</head>
.
2. Run the SWFFormFix(yourObject) command on your SWF.
Example with SWFObject (recommended):
<div id="swfdiv_ttpreview" style="width:200px;height:100px;">
This is replaced by the Flash movie.
</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("myMovie.swf", "myMovieObjectName",
"200", "100", "6.0.0", "#ffffff");
so.addParam("quality", "high");
so.write("swfdiv_ttpreview");
SWFFormFix("myMovieObjectName");
// ]]>
</script>
Example with std Flash EMBED tags:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="200" height="100" id="myMovieObjectName" align="middle">
<param name="movie" value="myMovie.swf" />
<param name="quality" value="high" />
<embed src="myMovie.swf" quality="high" width="200" height="100"
name="myMovieObjectName" type="application/x-shockwave-flash" />
</object>
<script type="text/javascript">
// <![CDATA[
SWFFormFix("myMovieObjectName");
// ]]>
</script>
If you are still using the old school EMBED tags, you should really get with the program and start using SWFObject!! SWFObject (by Geoff Stearns) not only cleans up your code, but it removes the annoying gray box around your Flash movies in Internet Explorer 7 (or earlier with updates). I made a nice little script called HTML2SWFObject a couple months back that converts your old EMBED code to SWFObject code - check it out!




( 3.1 / 772 )

Calendar



