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

Super dad movies No Comments »

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

 

Posted via web from wiibart’s posterous


Send multiple photos(max5) with iPhone 3.0

Super dad movies No Comments »

Just found out that you can send multiple photo’s with iPhone 3.0
If you go to your photo library and click on the share icon you can select up to 5 photos and then send them with email. I send these photos to post@posterous.com and what see see here is the result of that, pretty cool I must say.

See and download the full gallery on posterous

Posted via email from wiibart’s posterous


Facedrum with augmented reality

Super dad movies 1 Comment »

Okay, I was distracted by the guys who made FlarDrums. (Augmented reality with sound) As there was a demo I had to check it out. You can do too http://www.squidder.com/flardrums

Posted via web from wiibart’s posterous


How to delete your photo’s from your iPhone

Super dad movies No Comments »

I had 4161 photos on my iPhone and managed to sync them to iPhoto. But you can only delete your photos at the end of the sync process.
This video shows you that you can use the Image Capture tool to delete your photo’s from your iPhone.

Posted via web from wiibart’s posterous


CEO of WEA John Esposito jamming and interview 8 videos

Super dad movies No Comments »

I got an email from my Viddler friend Shimon Sandler who published 8 videos featuring the CEO of Warner, Elektra and Atlantic. I really like the guiter play, so I’d thought I would made a post with all the videos easy clickable, yeah.

Posted via web from wiibart’s posterous


using callback functions with SwfLoader

Super dad movies No Comments »

I am working on a Air application where swf files are loaded with SwfLoader and where I want them to be able to write to disk. You can do this with events but I thought I’d look at using callback functions, and I must say I like it, it works pretty nice.

First the Air application. When the swf is loaded we tell the loaded swf wich function to use using the SetCallback function that must exist in the swf.

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute>

<mx:SWFLoader id=”loader” source=”LocalSaveTest.swf” complete=”initSwf()”></mx:SWFLoader>

<mx:Script>

<![CDATA[

import flash.filesystem.File;

import flash.filesystem.FileStream;

import flash.filesystem.FileMode;

public function initSwf() : void

{

(this.loader.content as MovieClip).SetCallback(AirFunc);

}

public function AirFunc(text:String) : String

{

SaveXmlToFile(text);

return "saved text to disk";

}

public function SaveXmlToFile(xml:String) : void

{

var file:File = File.applicationStorageDirectory.resolvePath("testfile.txt");

var stream:FileStream = new FileStream();

stream.open(file, FileMode.WRITE);

stream.writeUTFBytes(xml);

stream.close();

}

]]>

</mx:Script>

</mx:WindowedApplication>

 

 

And the swf file looks like this;

 

public var Callback:Function;

public function SetCallback(callback:Function) : void

{

this.Callback = callback;

}

 

case MouseEvent.CLICK:

//call the callback

var result:String = this.Callback(text);

break;

Also read following article

http://www.jadbox.com/2009/02/as3-optional-callback-method-warning/

I hope you liked this post, you can leave comments using your twitter credentials using OAth.

Bart

 

Posted via web from wiibart’s posterous


WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in