MovieClipLoader onLoadError event does not fire in Firefox when a non-existent domain is targeted
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
4 Responses so far
Kevin
April 4th, 2007
10:57 pm
Interesting problem that you have there. I am having a similar problem and it is KILLING me:
I have coded a video player that works correctly in IE and FF on Windows, and Safari on OSX, yet fails hard in FF on OSX. I am not sure why, but all of the netStream status events fail to call… not sure what the problem is or why it only happens in the one browser/os configuration.
Thanks for the post, though.
Rob Kiebert
April 11th, 2007
10:58 pm
Also strange:
When I use the function loadClip(MediaUrl, targetMovieClip) with an undefined target MovieClip, IE starts loading the MediaUrl. While Firefox loads nothing and gives no response.
Strange!
Scott
April 12th, 2007
10:58 pm
Hi Rob,
As Strange as it sounds it kind of makes sense. It looks like the onLoadError event will never trigger in FireFox if the onLoadStart event is never fired.
Since the MovieClipLoader class is using the browser to accomplish the http request there must be a difference in how each browser instantiates the call.
Scott
Hector
July 24th, 2009
7:30 am
Hi scott,
I’m having the same problem loading an external asset and trying to trap the error.
For me the onLoadError event is not working when attempting to load a non-existent asset from a valid domain in internet explorer 8.0.6001, Firefox 3.0.12 or safari 4.0.2.
So it seems the onLoadError event only fires IF a file is found but fails to load afterwards for some reason.
Do you know any other way to be able to tell if flash fails to find an external asset?
Leave a comment