Flex 1.5: Modifying custom HTML wrappers to workaround ActiveX updates in Internet Explorer
Issue
A recent update for Microsoft Internet Explorer significantly affects the way ActiveX controls are loaded in the browser. More information on this update can be obtained from Microsoft at http://support.microsoft.com/kb/912945.
There is a hot fix available that updates the Flex 1.5 compiler to auto-generate an HTML wrapper that is not affected by this change.
This article explains how to manually implement the hot fix for use with custom HTML wrappers. Manual JavaScript changes are required and detailed below.
Solution
You can write your own HTML wrapper for your SWF files rather than use the ones generated by Flex. It can be an HTML file, a JSP file, a ColdFusion page, or an Active Server Page (ASP).
The JavaScript modifications below enable the wrapper to make ActiveX content "active" without requiring the user to click.
To implement, move the <object> and <embed> tags from the main HTML wrapper to an external JavaScript file, then reference the file in the HTML wrapper with a script tag.
<script href="flexwrapper.js"></script>
Examples
flexwrapper.js
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0' width='100%' height='100%'"); document.write("id='test.swf'"); document.write(">"); document.write(" <param name='src' value='test.swf'>"); document.write(" <embed pluginspage='http://www.macromedia.com/go/getflashplayer' width='100%' height='100%'"); document.write(" src='test.swf'"); document.write(" name='test.swf'"); document.write(" />"); document.write("</object>");
HTML Wrapper Example Page
<html><head><title></title></head><body><noscript><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,14,0' width='100%' height='100%' id='test.swf'><param name='flashvars' value=''><param name='src' value='test.swf'><embed pluginspage='http://www.macromedia.com/go/getflashplayer' width='100%' height='100%' flashvars='' src='test.swf' name='test.swf' /></object></noscript><script href="flexwrapper.js"></script></body></html>
Download the example files. (146K)
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
