Search code examples
apache-flexnetwork-programmingflash-builder

network checking application flex


I appreciate any help or guidance that I can get. Thank you for going through my problem.

I followed this tutorial http://www.jamesward.com/2010/04/01/video-build-your-first-desktop-application-with-flash-builder/

I copied that exact code that he wrote. But the application he built is working but mine is not. :(

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>

            import air.net.URLMonitor;

    </fx:Script>

    <s:applicationComplete>

            var mon:URLMonitor = new URLMonitor(new URLRequest("http://www.adobe.com"));
        mon.addEventListener(StatusEvent.STATUS, function(event:StatusEvent):void
        {
        check.selected = event.currentTarget.available;
        });
        mon.pollInterval = 500;
        mon.start();

    </s:applicationComplete>
    <s:CheckBox id="check" label="Online" verticalCenter="0" horizontalCenter="0" />

</s:WindowedApplication>

Any clue or idea that you can help me make this app work please ?

Thanks Bilal Ahmad


Solution

  • This gets solved by setting the polinterval to zero.

    For assistance please see the link below

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/air/net/ServiceMonitor.html#pollInterval