Using Prototype with Adobe AIR
Long story short: I found out the hard way that Adobe has nerfed the AIR runtime so that any JavaScript functionality that relies on the eval() function doesn’t work*. Sweet.
I’ve been wanting to play with AIR more, but every time I get into this system I find myself banging my head on the wall. I wanted to start a personal project with AIR - just something to remember and search some notes for now. I had a nice little JavaScript MVC framework going on. I was dispatching events related to commands… those events were being dispatched to the correct controllers… the controllers were… not rendering any view code. Crap.
The problem lies in the way AIR nerfs eval() functionality in Prototype. Something as simple as $(’id’).update(data) doesn’t work because String.update (along with most AJAX functions) automatically eval() script segments in the strings they work with.
* Okay, so you can get it to work, but you have to split out your main HTML interface into an iframe and create a bridge between the two sandboxed areas (the AIR-enabled root HTML file, and the AIR-nerfed, Prototype-enabled iframe. Yuck.
If anyone has any ideas how to get around this, that’d be nice. I suppose I can see why Adobe would be careful about allowing developers to eval() anything they like, but the proposed solution is really nasty and doesn’t solve anything anyway.
This entry was posted on Monday, October 29th, 2007 at 7:09 pm and is filed under javascript, air. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply