IE6 is bugalicious with AS3
After recently launching a flash site developed in AS3, a stupid, stupid bug appeared that caused a slight amount of brain trauma. In InternetExplorer 6 the site loaded, and worked fine. But when you would navigate elsewhere and come back to the site, everything was all screwy. The alignment was off and the site wouldn’t initialize. Clear your cache, reload and everything was perfect. So, obviously its a cache problem, and it only occurred in IE6.
Here’s how I had my project set up:
index.fla contained all the site library instances and all instances were set for export, but not on the first frame. The second frame of index.fla contained all the instances placed on the stage and the third frame was blank. MainController.as was set as the document class for index.fla. MainController.as was set up to load the site somewhat like this:
public function MainController():void {
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
this.loaderInfo.addEventListener(Even.COMPLETE, onLoadComplete);
}
private function onLoadProgress(event:ProgressEvent):void {
var bLoaded:Number = this.loaderInfo.bytesLoaded;
}
private function onLoadComplete(event:ProgressEvent):void {
this.gotoAndStop(3);
//load and initialize your shell file here
}
Eventually I ran across this post: http://pixelfumes.blogspot.com/2007/07/ie6-as3-preloader-events-failing.html
So what was happening is that the progess event and complete event would never fire for the load of the site once the site was cached in IE6. Also, my alignment of objects that were added to the stage before the load, like the site loader instance, were not properly aligned because I was positioning them based on stage.stageWidth/2 and stage.stageHeight/2, and for some odd reason, after being cached, in IE6 it wasn’t able to access the stage properties.
So here is a good work around. index.swf loads a new swf file, main.swf, which contains all the library instances set for export on the first frame, and initializes the site. So, index.fla contains just the instances for loading, like your loader graphics, and has a document class, maybe called MainLoader.as. MainLoader.as (index.swf’s doument class) loads main.swf. main.fla has a document class called MainController.as. MainController.as initializes your site.
There are three great advantages to this method. First, no IE6 bugs. This bug will most likely never go away, Microsoft sure as hell isn’t going to be doing anything about it, and why would Adobe want to target their application for IE6? SECOND, all your classes will be initialized in the MainController.as. So, not only will MainLoader.as load all the library instances set for export in main.fla, but it will also load all the class files for your site. BOOYAH! THIRD, no timeline, at all. It’s use was minimal with the original method, just adding 3 frames, but with this one there is no need to touch the timeline.
Sure, its a pain to have two fla’s and two document classes, but this method is the best that I have come across since it loads both the library and classes. The only other workaround would be to start a global anti-IE6 campaign. Which I am honestly thinking about doing.


It also occurred in IE 7, I believe.
Comment by Mark — November 30, 2007 @ 4:07 pm
http://blog.thebigreason.com/2007/11/29/a-plead-to-the-web-design-community/
Comment by Mark — November 30, 2007 @ 4:09 pm
http://www.webdesignerwall.com/general/trash-all-ie-hacks/
Comment by Mark — November 30, 2007 @ 4:09 pm
Huh… Your blog is nice in general, but this very post… It is brilliant!!! It can be never better.
Comment by Tracy@SEO — April 10, 2008 @ 10:16 pm
What is Flash?
Comment by Krulbqr — July 7, 2008 @ 12:54 pm