Flex, AIR, and ActionScript, oh my!

May 5, 2009 at 6:00 pm (Flex, Week 7) (, , , )

I’ve thought for a long time that I’d like to have at least a cursory knowledge of ActionScript (the scripting language that runs on Adobe’s Flash platform), and once Flex became more well-known I thought of it more often. Today Micah gave me a reason to actually get into it a little bit. My assignment was to investigate AIR, Adobe’s newest platform, which allows you to run Flex applications outside the context of the browser as regular desktop applications. The idea is sort of a kiosk-mode application for a client, and while I encountered (and partially) some technical problems with Flash’s security mechanisms, I also gained some reading knowledge of ActionScript and MXML, the markup language for Flex.

I haven’t done anything really interesting yet as far as layout goes, but it was super-easy to embed basic web browsing capability into the application:

<mx:HTML
id="html"
height="100%" width="100%"
location="http://www.google.com" />

I only did some very basic ActionScripting, but it shares some syntax with JavaScript: the var keyword for local variable declarations and the function keyword for, well, you know… On the other hand, ActionScript has classes, which is of course more like Java. The technical issues I ran across forced me to look into a good bit of event and listener code, which is good for me since that’s probably the aspect of JavaScript I understand the least. Luckily, I happen to know an ActionScript master from my Athens days, and he was able to set me straight on a minor limitation of the Flash platform.

There’s a little weirdness in the construction of an AIR application. A lot of the just-starting documentation assumes that you’re using FlexBuilder (Adobe’s expensive IDE), and I’m not. Also, you can do a lot of behavioral programming in Flex either with ActionScript or with MXML. I wasn’t sure how to get started with plain old ActionScript, so I have kind of a bloated MXML file at this point (all my ActionScript is embedded in mx:Script tags). I’m sure there’s a way to extract that to another file, but for now I’m just spiking to see if this is a technology that will work for our client.

The big question marks left have to do with packaging up the AIR runtime (and with it, I suppose, Flash itself, in case that’s not installed) so that the install of our application would include the installs of Flash and AIR. Once I finish tracking down the answers to Micah’s questions on AIR, I’m going to be joining him and Doug on their project. I’m very much looking forward to having more opportunities to see them in action coding, and also to be working in a new domain. Also, their project has one component written in Objective-C, so it will be cool to at least get a bit of reading knowledge in that language.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: