dipti
dipti

Reputation: 11

how to check internet connection is available or not in flex

can anyone help me, how to check whether internet connection is available or not in my flex application.One more scenario is, if network connection is there but some problem in internet connection how to check internet connection is available or not.

Upvotes: 1

Views: 5145

Answers (2)

Jeremy Keczan
Jeremy Keczan

Reputation: 115

The answer above works but I would like to add that pointing it to your server directly(if you have one) rather than just Adobe will also allow you to monitor your own server and handle it accordingly.

Upvotes: 2

b-ryce
b-ryce

Reputation: 5828

There is a good example here: http://livedocs.adobe.com/flex/3/html/help.html?content=network_connectivity_1.html

import air.net.URLMonitor;
import flash.net.URLRequest;
import flash.events.StatusEvent;

var monitor:URLMonitor;
monitor = new URLMonitor(new URLRequest('http://www.adobe.com'));
monitor.addEventListener(StatusEvent.STATUS, announceStatus);
monitor.start();

function announceStatus(e:StatusEvent):void {
    trace("Status change. Current status: " + monitor.available);
}

Upvotes: 3

Related Questions