logo

My Very First Adobe AIR Application

Last week a friend (of a friend) called wanting advice on how to write a bit of software to fetch temperature readings from his log-fired boiler. What at first seemed like a bit of an odd request soon got the geek in me interested and I ended up tinkering with a "proof of concept" that led to me creating my first Adobe AIR application.

Said friend lives in the sticks and heats his house using a log-fired burner and a huge tank of hot water. Both have thermometers on them which are connected to a 1-Wire system, which is connected to his router/LAN. This device has an IP address and hosts a web server. You can use an "API" to request certain URLs, passing in the addresses of the thermometers and it returns HTML tables of temperatures.

What friend wanted was an easier way to monitor the temperatures. So I threw together a browser-based Flex app to request and parse the HTML. Although this worked locally with the test HTML I had, it didn't work for him when online.

The reason it wouldn't work is that the Flash player (when in the browser) can't access data from a URL on a server that doesn't have the cross-domain policy file on it. Because the embedded server on his device didn't have one (and there was no way to add it) I had to give up on a web-based Flex solution.

Instead I converted the Flex project to an AIR project. As the Flex code then runs from the desktop it isn't as paranoid as when in the browser and so it can request data over HTTP from servers without a policy file on them.

This was the first time I'd created an AIR app and was amazed how easy it was. If you can create a Flex app you already know how to create an AIR app. All I did to migrate my un-workable Flex attempt over to AIR was create a new AIR project, paste the code over and re-compile it.

The output from the AIR project, rather than being an .SWF file is an .AIR "package" (which has the SWF in it along with some other bits and bobs). You can then install this locally and/or distribute it to other people who have the AIR runtime installed by email or web download etc.

Here's the app running on Mac OS X (just to prove a point about it being cross-platform):

ha7

Notice how I've made the app fixed-size and disabled the maximize button. Two things you can't do with a web-app.

Notice the pretty little transparent thermometer icon in the dock (a PNG file which I stole from Google Images). Again, not something you'd get with a web-based app.

So, what's best? Flex in the web or in AIR? I'll talk more about this tomorrow and at some point hope to have an AIR app you can install that interacts with Domino, so you can decide for yourself. As always though, it's "horse for courses".

Comments

  1. How did you like the process of creating and running the application? I have a strong memory of running into trouble just getting it to create something that would execute or "open with" the Air framework to run properly. Then again that was with the flex3 demo, not flex4. One hopes for incremental improvements in certain areas.

      • avatar
      • Jake Howlett
      • Mon 29 Mar 2010 08:46 AM

      This was all done in Flex3 and I had no trouble at all. Well, there were a few oddities where the air package exported ok but when installing it said it was "damaged". After exporting again it worked fine. Guess it's always worth testing the AIR file before releasing it.

      Apart from that I found it very easy to create an installable desktop app in no time at all using my existing web-based Flex knowledge.

      Jake

    • avatar
    • Dragon Cotterill
    • Mon 29 Mar 2010 09:34 AM

    Off at a slight tangent here... but what are those temperature devices? Reason being, at some point this year, Wifey and I will be moving to the "sticks" (although still in ADSL range). Remote temperature information of the greenhouses and pools would be very useful to me. Can you get a brand name/code of them so I can go get a bit more info on them? Thanks.

      • avatar
      • Jake Howlett
      • Mon 29 Mar 2010 09:50 AM

      Some further reading you might be interested in:

      http://www.embeddeddatasystems.com/

      http://www.homechip.com/catalog/

      http://www.klein.com/thermd/

      It's enough to bring out the nerd in us all.

      Jake

      Show the rest of this thread

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 29 Mar 2010

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content