Posts tagged ‘Air’

Adobe Air development

I was talking to a friend about lack of a good interface for discovering NetFlix movies that do actually stream. The problem is that most of the movies are DVD distribution only. Further the streaming movies are sometimes streaming and sometimes not. It has something to do about when they are showing on TV. If your like me, you want to watch your movie at the end of the day when there is nothing on TV. In that case you want it streaming right there and then.

So I figure why not create a small app that will keep a list of the movies your wanting to see and it should be able to refresh and show you which ones are available for NetFlix streaming at any given time. Sounds easy enough, but there is a catch, I wanted it cross platform as my friend mostly uses a Mac. Hmm so I was thinking that’s easy enough just create simple C# program that will run smoothly on Mac under Mono. No that’s too easy, then it came to me, I have wanted to look at Adobe Air apps, this is a perfect opportunity. Let’s give it a try, as added bonus I wanted to do some dev on my Linux box. It should be fun to create this little app on the Linux and have it run on PC and Mac as well.

Well it turns out that Adobe only supports the FlashBuilder on Win and Mac, no Linux for you my friend. But we don’t give up that easily, I don’t want to run under Wine, turn to google and I find Fb4Linux. As it turns out after installing a bunch of libs and the FlashBuilder and some Sdks and such that I couldn’t get it to run under Linux ( I might try again later ). I’m probably not running the same versions of stuff as the author of the instructions, or maybe I just can’t follow instructions that well. Oh well, back to Windows, get the install from Adobe and it installs fine, then run the IDE, it plugs into Eclipse. Sure enough nothing to be found there, but wait a minute, not only do they ( claim to ) install it as plugin in your existing Eclipse, they also install a whole new instance of Eclipse. Sure enough when I run that new instance FB comes up and works as expected, you can start a new FB project etc.

Now with all the install trouble out of the way let’s give it a spin. File -> New Flex Project, the basics are setup for you by the wizard. Drag a couple of controls on the panel, goto properties and create click event for the button, there you have it “Hello World” Then click export, go through the wizard and an .air install file has been created. That’s pretty nice considering that I didn’t read any quick starts tutorials. But wait a minute, I click the air file to run it on my desktop and get some error indicating corrupted Air install file, contact the provider for a new file etc. Google search to the rescue and after un-installing and re-installing Air, nothing had changed. Then I uncheck the option of having a Timestamp in the digital signature of the .air file and that did the trick, now I can run and install, uhh.

Things seem to be looking up, time to code this puppy….. when I get to it, not sure if I’m going to pursue that or not, might be a follow up post. Notice all the javascript, might be too web-ish for my taste.

Here is Hello World in code

<?xml version=“1.0” encoding=“utf-8”?>
<s:WindowedApplication xmlns:fx=“http://ns.adobe.com/mxml/2009”
                                           xmlns:s=“library://ns.adobe.com/flex/spark”
                                           xmlns:mx=“library://ns.adobe.com/flex/mx”>

                <fx:Script>
                <![CDATA[
                        import mx.events.FlexEvent;
                       
                        protected function button1_clickHandler(event:MouseEvent):void
                        {
                                txSome.text = “Hello World !”;
                        }
                ]]>
        </fx:Script>

        <fx:Declarations>
                <!– Place non-visual elements (e.g., services, value objects) here –>
        </fx:Declarations>
        <s:Button x=“37” y=“10” label=“Button” click=“button1_clickHandler(event)”/>
        <s:TextArea x=“37” y=“52” id=“txSome”/>
</s:WindowedApplication>

And the app itself

Update
—–
I got Flex builder working later on the Linux box after some tinkering, that’s how the sample looks there.