• Never used that s:applicationComplete tag, looks quite handy!
    And I guess it exists for most (if not all) events, I’ll try that out!

  • @Quentin

    That is just another way to set an event handler.

  • That’s a cool one, because the WindowedApplication and Application tend to have quite a lot of attributes and namespaces, which makes them hard to read…
    Nice to have these tags around!

  • Miha

    Using this technique you just showed you’re basically not really checking if the user is online but just checking whether an URL is reachable. I’ve been confused by how occasionally my Acrobat.com air application tells me “To connect to the Internet” upon startup, while I was connected to the internet (browsing, everything else worked normally). If they use the same technique you just showed it could mean that just the acrobat.com servers were offline (or not reachable for some other reason) and should’ve displayed a more appropriate message that “Connect to the Internet”. Is there no AIR api that hooks into the OS broadcast for internet avaibility (windows 7 does a pretty good job figuring out that for itself, surerly it sends some kind of message when internet is avaible or not) ?

  • @Miha

    All the the OS is doing is checking some URL that it believes should always be available. So in your app you could certainly check http://www.google.com or something that should almost always be available. However most applications rely on services on a specific host – like the Acrobat.com AIR app relies on http://www.acrobat.com being available. For the app to function in online mode http://www.acrobat.com needs to be available. It doesn’t matter to the app if the problem is that the user is disconnected from Internet or http://www.acrobat.com is down. A better error message in the Acrobat.com AIR app would probably be something like “Can’t connect to http://www.acrobat.com. Either your Internet connection or http://www.acrobat.com is down.” Alternatively if the Acrobat.com AIR app can’t connect to http://www.acrobat.com then it could try to make a connection to http://www.google.com and if that doesn’t work then there is probably a good chance that the user’s Internet connection is down.

    Does that help?

  • Miha

    Agreed, a better error message for the Acrobat.com AIR app would be “Cant connect to the acrobat.com service” than “No internet connection is available” if only acrobat.com is unavailable. But my biggest fear after watching the video was that people would code it like this, although after lookup it now i see it’s unecesarry. The NativeApplication does transmit a “networkChange” event and even the URLMonitor class handles it, by sending StatusEvent when there’s a network change. But by providing a pollInterval of 500 ms you overriden that behaviour and forced a HTTP GET every 500ms, which is the part I don’t like ( imagine every application you have running polling http://www.adobe.com every 500ms would be quite a waste of bandwidth). So my suggestion is not defining a polling rate (just delete that line) and the app still works the same, giving the OS and the AIR runtime the chance to notify you when the network changes because you’re most likely gonna end up writing error handling code for service requests anyhow.

  • Thanks for the feedback. That is useful information for people building AIR apps.

  • Rex

    Now, all we need is an AIR framework installer for that Nexus One you keep showing us… :)

  • Hey Rex,

    We haven’t announced AIR for the Nexus One. Just Flash Player 10.1. But we have announced AIR for the Droid. No dates have been announced yet.

    -James

  • Rex

    Hi James,
    Motorola just announced Android 2.1 for the Droid today – therefore shouldn’t AIR on the N1 be there too?


    Rex

  • It’s up to the individual handset distributors to decide if they will support AIR or not.

  • Rex

    Seems inconceivable that they wouldn’t when others in the OHA are. Is there more to this story?

  • Kwame

    Hello James,
    Thank you for your tutorial. They are very good; But please can you send me the complete code + all jars
    for the tutorial you put on Adobe.com on “Flex 4, Java, Spring, and Hibernate in Flash Builder 4”
    Thank you
    Kwame
    PS: Please what is the mining of the code screen. I was not able to put comment on adobe site

  • @Kwame We are working on updating our Flex + Spring Refcard that will contain everything you need. Stay tuned.

  • Kwame

    James,
    Thank you very much for your kindness.
    Please, can you email me when it will be ready? also if you will have time,
    why not include in the next post on Refcard an explanation about how to resolve
    the famous “hibernate-lazy-loading” problem may be with dphibernate.
    Really, it will make us happy.
    best regard,
    Kwame.

  • Kwame

    Hi, James
    When approximately do you think the new Flex + Spring Refcard will be ready?
    Kwame

  • @Kwame Hopefully in the next few weeks.

  • Wesley Dhanasingh

    is there possible to send email through Flash Builder 4 AIR Application? please give me your valuable tip.

    • You will have to do this on the server.

  • denesh,

    hi, i have problem in my adobe air application auto update. once its downloading the air while starting its says error.

  • Felix Abraham

    Hi James… I am planning to develop a desktop application simulating a hotel reservation system(reservations, bookings, invoices). It will be an intranet application with a server. Is AIR a good choice? What back-end and database technology do you suggest i use? I come from a windows desktop application development background and am thinking of switching to a technology that is OS independent. Any help is highly appreciated. Thanks!

    Felix

  • Liujunwy

    不错啊!很好!

  • Bala

    Hi James

    This Bala i need to create desktop application. how can i connect mysql database without using any server like as(php,html,java).. It’s possible means plz tel me….

    Thanks ……….

    • webdev

      hi bala you can create destop application with php,html,java with titanium studio

      if you need any help contact me on sype:gvcyber1

    • Jsmartz

      Hi Bala, you should use Zinc 4.0 which let’s your Flash/Flex project connect to mysql directly (no PHP, java etc). http://www.multidmedia.com/software/zinc

  • Deepak

    I have authored the same code in the latest flash builder but it’s not working but am I doing wrong

    import air.net.URLMonitor;

    var mon:URLMonitor = new URLMonitor(new URLRequest(“http://www.adobe.com”));

    mon.addEventListener(StatusEvent.STATUS, function(event:StatusEvent):void {

    c.selected= event.currentTarget.available;

    });

    mon.pollInterval=500;

    mon.start();