Ehsan
Ehsan

Reputation: 2285

How to check network availability in action script?

I want to check network and Internet availability in Action Script programming language. please help me.

Upvotes: 1

Views: 169

Answers (2)

Rukshan Dangalla
Rukshan Dangalla

Reputation: 2590

var request : URLRequest = new URLRequest  ( YOUR URL HERE );
var loader : URLLoader = new URLLoader ();
loader.addEventListener( Event.COMPLETE, handleLoaderComplete );
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);
loader.load ( request );

protected function ldrStatus(evt:HTTPStatusEvent):void
{
 trace(evt.status)
}

protected function handleLoaderComplete(event:Event):void
{
  trace("COMPLETE");
}

try above code, evt.status should give 200, in success.

Upvotes: 1

Mira
Mira

Reputation: 563

If you are using AS3, You can use HTTPStatusEvent

Upvotes: 0

Related Questions