Archive for the 'javascript' Category

Using Prototype with Adobe AIR

Monday, October 29th, 2007

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.

Firebug, Where am I?

Friday, October 19th, 2007

It’s stuff like this that makes me feel verified in my lack of interest in using jQuery heavily.

There’s a guy who wrote a logging function so you can figure out whereYou(are).whenYoureCoding().inThe(middleOf).a(jQuery).trainWreck().

I can see the power of chaining things together, but my guess is you’ve probably gone too far if you’re needing to log things to the console mid-swing. There’s probably little to no chance you’re going to be able to read it a week from now, too.

 
random side bar image...