Archive for June, 2008

Personal, Technology

I am going through… the change

Ok, I can’t put this off any more. I keep not blogging about little things because I told my self I wouldn’t write anything else until I got this more important post out of the way. But I keep not having time for this more important post, so I just need to get this done.

After nearly 10 years in the web application development business as an employee of one company or another I have decided to strike it out on my own. As many of you know I have been living a double life for the last couple years. By day I have been the Director of IT for a small business in portland. By night (and the occasional week) I have been a freelance developer and trainer. But the emphasis of my time has always been on the day job. As of June 1 this is no longer the case. For the last month I have been working part time for my day job and committing the bulk of my time to freelance work. And I have to say I am very happy for finally making this commitment to my self and my family. My wife has been trying to get me to do this for a couple years, she is very supportive and I think she likes having me around more (even if I am working.)

I will continue in my day job part time through the end of the year and then they will become one of the companies that I do work for as they need it.

So far I have been very busy. I picked up a couple smaller gigs just before landing a 6 month contract with Cisco. I have really enjoyed working with the great people on these project and the challenge of doing something new.

Anyhow, I just thought I would share this life change with you all. Plus now I can get back to writing little helpful posts because this milestone blocker post is done :)

Thanks,
sim

Technology

Building AIR applications with just the command line

I had a moment today where I wanted to find out some more information about Silverlight. I looked around but was unable to find any path to building the plugins with anything but the Visual Studio environment. That frustrated me quite a bit. At that point a friend pinged me to tell me a story of woe about his unsuccessful attempts to build AIR applications without one of the formal IDE’s. And while I had used the AIR SDK to launch and build HTML JS example applications I had never tried to build one using the Flex SDK. He challenged me to grab any example code on Adobe Labs and compile and launch the application using just the command line tools.

I accepted the challenge (beer me) and thought I should talk about how to build an AIR example application that was created in Flex Builder using just the free SDK tools. The first step is to actually download and install both the Flex SDK and the AIR SDK. I unzipped these folders and added the bin directories of each to my $PATH. Now I could execute any of the mxmlc or adl tools from the command line. Next I retrieved the source code for a flex based example application in AIR. After unzipping the the the source code and `cd`ing into the src directory I decided to just give a go at compiling the code. Using mxmlc gave me an error about the compiler no knowing what a WindowedApplication element was. So I added the air folder in the frameworks/lib directory of the flex sdk to my -source-path. Now my application compiled fine using the following command.

mxmlc -library-path+=/System/flex_sdk_3.0.0.477/frameworks/libs/air HTMLScout.mxml

This created a HTMLScout.swf file in the same folder as the .mxml file. Then after looking at the mxmlc options for a bit I realized I could skip that long scary path by just using the configname parameter.

mxmlc +configname=air HTMLScout.mxml

Which also compiled just fine. But just because Adobe knows that in general programmers are lazy, they also created the amxmlc executable which as you might guess, adds that config parameter for us. So to compile an MXML file inluding the AIR libraries we just

amxmlc HTMLScout.mxml

So now we have a swf that can be used as the content for our applications. Because when it comes right down to it AIR is just a wrapper for our content exposing a little more functionality than we have in the browser. So we can set the initial content of our AIR application to be any html or swf file. The trick here is that when using Flex Builder to create your AIR applications it sets the initial content property for you. But when compiling from the command line we have to have that set explicitly. So open up the application descriptor file for the example application you downloaded and look for this line.


<content>[This value will be overwritten by Flex Builder in the output app.xml]</content>

You need to change that to actually have a value that represents your base content. In my case the value needs to be:


<content>HTMLScout.swf</content>

Save that application descriptor file and use adl to launch your AIR application.


adl HTMLScout-app.xml

Sit back and bask in the glory of building applications that run on Mac, Linux and Windows for no cost at all. For more information please check out the following 2 pieces of documentation.

AMXMLC
http://livedocs.adobe.com/flex/3/html/CommandLineTools_2.html#1043794
Application Descriptor File
http://livedocs.adobe.com/flex/3/html/help.html?content=File_formats_1.html#1043413