day macha
“Error #2044: Unhandled onError:. text” - Loading youtube videos from Flash

I was getting this error in a Flash file when loading Youtube videos with SWFLoader. But only in Firefox - not in Chrome or Internet Explorer. I added various event listeners for EventError and IOEventError to try to catch the error. I even added a security exception for youtube.com. None of this worked.

What I didn’t realise was the error was coming from Youtube itself, not my application directly. The ‘onError’ error appears to be this (http://code.google.com/apis/youtube/js_api_reference.html#Events) error. A simple event handler:

yourSwfObject.addEventHandler(‘onError’, function(e:Event):void{

//your event handling code here

}

deals with it. But only if:

Security.allowDomain( ‘http://www.youtube.com’ );

is also added to the code. It all seems a little voodoo though: only Firefox splurges out this error - and not on all Firefox/flash combinations - and the event handling code only works when youtube.com is given a security exception. Ho hmm. If anyone can shed light on this mystery, I’d be very grateful.

Blog comments powered by Disqus