Mar 28

Today at work we ran into another flash player / browser inconsistency. When using MovieClipLoader to load an external asset, the onLoadError event doesn’t fire in Firefox when trying to load an asset from a non-existent domain. In fact, the onLoadStart event doesn’t even fire. The other MovieClipLoader events don’t fire but they shouldn’t, there isn’t any progress and the load never reaches completion or initialization.If you attempt to load a non-existent asset from a valid domain the onLoadError event fires fine in Firefox. In IE and Safari the onLoadError event fires in both scenarios. These are the only browsers I tested but I would be interested in seeing what happens in the others.

So let me break it down. This code doesn’t fire the onLoadError event in Firefox. It just fails silently:

var mLoader:MovieClipLoader = new MovieClipLoader();
var mObj:Object = new Object();
mObj.onLoadError = function(ev:Object):Void {
     getURL('javascript:alert("onLoadError")');
}
mLoader.addListener(mObj);
mLoader.loadClip('http://kaljdflkasjdf.com/image.jpg', this);

However, this code and domain do fire the onLoadError event.

var mLoader:MovieClipLoader = new MovieClipLoader();
var mObj:Object = new Object();
mObj.onLoadError = function(ev:Object):Void {
     getURL('javascript:alert("onLoadError")');
}
mLoader.addListener(mObj);
mLoader.loadClip('http://www.scottgmorgan.com/image.jpg', this);

Thought I would share this knowledge with the world. Last thing I want is others pulling out as much hair as I do :)

Tags: , ,

Jun 23

I thought I’d seen it all, but this is one of the strangest. A developer on my team built a standard preloader using the MovieClipLoader class, been done a million times. Very standard stuff, using the onProgress event to position a progress bar by calculating the percentage with the bytesTotal and BytesLoaded arguments. Worked perfectly in IE on a PC. In Firefox the progress wouldn’t move past 0% unless the user moved their mouse. WTF?!?

After hundreds of traces, an old school loadMovie with an onEnterFrame or interval calculating the load progress with getBytesLoaded() and getBytesTotal() every iteration, Nothing!. Same thing everytime. 0% unless we moved the mouse and only in Firefox on a PC.

Pulling at straws, and approximately 2 minutes before our systems took a 3 story plunge, we removed the wmode=transparent attribute in the embed html tag. Voila, the problem magically disappeared. Again, in unison WTF?!?.

Why the heck would the transparency effect the preloader? I have run into issues with memory spikes when wmode is set to transparent but things always work, just a little slower. Don’t get me wrong, I rarely use wmode=transparent, but in this case the designer had something specific in mind and there was no way around it. Well guess what, we ended up convincing the designer to change the background so it would match seamlessly in html and flash. Now we don’t have to worry about this.

Has anyone else seen this? Are we on crack? Feel free to contact me if you have seen this behaviour before. Soon I will have the comments section built and you will be able to post your comments right here. Right now I am chalking this up as a bug in the Flash player for Firefox.

Tags: , , , ,