Wednesday, February 18, 2009

ioloader error

I was having some major problems with some Actionscript 3.0 that I was writing. I was trying to write a try/catch block to handle the case when a URL was missing:

_metadata_loader = new URLLoader();
var request:URLRequest = new URLRequest(MarGridFlash._metadata_filename);

But no combination of try/catch worked. It turns out that it was a case of "ur doin it wrong", and instead, as I learned from this excellent post that I should instead be doing:

loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderMissing);

function loaderMissing(event:IOErrorEvent):void