Archive for the ‘Flash Player 10’ Category

The infamous Error #2044: Unhandled StatusEvent:. level=error, code= on LocalConnection

July 24th, 2009 1 comment

This is a blog post to all that was almost to throw their computers out of the window because they got "Error #2044: Unhandled StatusEvent:. level=error, code=" trying to communicate through LocalConnection.

So I am trying to send a message from a Flex application running in Flash Player to an AIR application. In the AIR application (called testAIR) I have something like:

private function initApp():void {
	var inbound:LocalConnection = new LocalConnection();
	//only allow connections from localhost
	inbound.client = new Object();
	//this is the function that will be called by the Browser App
	inbound.client.notifyPayment = function test():void {"HERE");

pretty straightforward, right from the book.

In the Flex app I just do:


You might think that this should work. Well … NOT.  This is because in the AIR app the inbound LocalConnection is a variable that is declared in the local scope of a method. Now I was expecting that when I call  the connect method the inbound object will be referenced by another object (some LocalConnection manager, or event handler) and it will not get garbage collected after the method ends. Well, apparently is not the case. Either there is a bug in AIR, either this reference is a weak reference so it gets garbage collected. This means that by the time you try to send the message from Flash Player your inbound object is long gone!

The resolution is quite simple. You just need to reference the inbound object somewhere else, making him a member of class or something. In my case I just declare it as a private variable inside my MXML component:

private var inbound:LocalConnection = new LocalConnection();

private function initApp():void {
	//only allow connections from localhost

Hope this will help someone :)

Categories: Flash Player 10, flex, tips & tricks Tags:

Can Flash Player help your research project?

March 23rd, 2009 Comments off

Last autumn I gave a talk at RoCHI ( a Romanian academic conference about human computer interaction. I wasn’t very excited to attend the talks there since I didn’t have very high expectation about the research activities in Romania. Well, I was very wrong. About half of the subjects and presentations there left me “mouth open’” .I also  had the pleasure to meet Mr. Sabin Buraga who I can say is a true Teacher 2.0 :) and who was one of the main responsible for putting together that inspiring conference.

But there is one subject in particular that I want to talk about: Augmented Reality. Because at that little conference I had the pleasure of staring at some extremely cool augmented reality demos. They were based, I think, on some versions of ARToolKit, also a joint research effort from multiple universities. And I was thinking: How can this technology be put to use on some real projects? How can it be evangelized?

Then I forgot about it until a colleague of mine showed me this demo. It was made with a Flash port of ARToolKit called FLARToolKit by Saqoosha. How cool was that, augmented reality in Flash!

And then the creative agencies got them and now it seems to be a fad:

and I think that BMW is preparing one for Mini.

I realized that once the ARToolKit algorithms got to run in Flash Player and thus reach 98% web audience and some creative agencies figured out they could do something with them, the technology just got free advertising worldwide. I am thinking that if you are working on the next graphical or visualization algorithms you might really want to consider them running on Flash Player. Just for the sake of a cooooool demo that can be seen by everybody. Not to mention that with Alchemy you can still have all or part of your algorithms written in C or C++ and compile them to run on Flash Player.

Categories: alchemy, Flash Player 10, thinking Tags:

Playing with Pixel Bender

November 10th, 2008 7 comments

As you probably know by now, Flash Player 10 has a new feature for image processing that allows you to perform some really cool effects and blends. Well actually this new feature is a little language for parallel computing. In this post I present some samples that show you how to integrate Pixel Bender with your Flex project from start to finish.

First of all you need the Pixel Bender Toolkit. You can get it from here. Second you will need to compile your Flex Project against Flash Player 10. There’s some documentation here. The whole idea behind my samples is that it took a while for me to put all things together and apply the effects on my Flex elements, and I want to make it easier for you.

In the first project I just made a simple Pixel Bender filter, which replaces the red channel with the blue one, and added it to an image.

Click here to see the demo

On the second project I used a filter with some parameters. It doesn’t do much, just clips a circle from the original image.

Click here to see the demo

The next one is a slightly more complex filter that has two input images. I use it to apply an image over a video.

Click here to see the demo

Finally, because Pixel Bender is basically a number cruncher, I use it to mix two ByteArrays. By chance :) these two ByteArrays are extracted from two sounds so this is also an example on how you can use Pixel Bender to mix two sounds.

Click here to see the demo (it might take a while before it starts playing because I have to load the sounds first)

UPDATE: The sound sample demo has two mixing methods. One is using PixelBender (onSampleData) and the other is using a pure AS3 code to mix. You can switch between the two (by changing the event handler at line 32) and and monitor the CPU to see if any performance improvements are detectable (on my computer is around 30%). I updated the demo to use the PixelBender method by default (thanks Chuck!)

You may want to take a look at the source code or download it.

Categories: Flash Player 10, flex Tags: