wiibart’s posterous

wiibart’s posterous

Bart Burkhardt  //  Continuous thoughts, strength and energy, that all combined is what you will see here

Jun 26 / 9:51am

Adobe Air nasty problem: there seems to be no way to catch TypeError: Error #1009 when loading a Swf

I am working on a Air application that loads external swf's.

The problem is that there seems to be no way to catch unhandled exceptions that occur in the loaded swf files. This is really annoying in the development process (everytime I have to click on popups) and also not very good in runtime because you really want to report problems in these external swf's.

The popups do not occur when deployed to a non-debugging application, so I guess I have to except this and stop moan about it, but if there is a way to catch it I really would like to know it, so that's why I make a blogpost. You can comment using your Twitter Oath authentication.

This is the error that popups everytime I run the application that loads the swf file using SwfLoader;

TypeError: Error #1009: Cannot access a property or method of a null object reference. at exceptionTest_fla::MainTimeline/frame1()[exceptionTest_fla.MainTimeline::frame1:2]

This a the code that I put in frame 1 of a test swf, it's obvious whats wrong in there, but thats on purpose, I want to have a swf that gives me the 1009 error.

[Frame1]
var textfield:TextField;
textfield.text = "test";

And here's the testcode that's in the Air app, it's very minimalistic, but it's just for testing.

[code of the Air app that loads the swf]
try
{
var loader:SWFLoader = new SWFLoader();
loader.load("exceptionTest.swf");
}
catch (er:Error)
{
trace("catched");
}

So the code above does never catch the 1009 error, if I add the try catch in the swf file then it catches fine.
It catches with the type Error and also with TypeError

 

0 comments

Leave a comment...

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     Connect     twitter