You Are Here:

Community: Wiki

This page was last modified on 8 September 2009, at 02:51.

How to check network status in Flash Lite 1.1

From Forum Nokia Wiki

In Flash Lite applications connecting to Internet, it is useful to check the network status, while making the connection.

  • If connection is being established or not
  • If connection failed Network error
  • If there is DNS Failure
  • If no HTTP request has been made

In Flash Lite 1.1 GetNetworkRequestStatus command returns a value indicating the current status of the most recent HTTP request. It can be any of the following values.

  • -1: The command is not supported.
  • 0: There is a pending request, a network connection has been established, the server's host name has been resolved, and a connection to the server has been made.
  • 1: There is a pending request, and a network connection is being established.
  • 2: There is a pending request, but a network connection has not yet been established.
  • 3: There is a pending request, a network connection has been established, and the server's host name is being resolved.
  • 4: The request failed because of a network error.
  • 5: The request failed because of a failure in connecting to the server.
  • 6: The server has returned an HTTP error.
  • 7: The request failed because of a failure in accessing the DNS server or in resolving the server name.
  • 8: The request has been successfully fulfilled.
  • 9: The request failed because of a timeout.
  • 10: The request has not yet been made.

Example

You want to show loading with animation and some time count.

  • Add this ActionScript code in the first frame
/:timerCount = "30";
/:requeststatus = fscommand2("GetNetworkRequestStatus");
  • Type loading text with animated movie clip
  • Load variable HTTP path.
loadVariables("http://www.google.co.in", "", "GET");
  • Check the request of HTTP status
if (/:timerCount>=0) {
play();
}

As GetNetworkRequestStatus returns 12 status values, you have to use switch statement to update a text with the current status in final_status.

switch (/:requeststatus) {
case -1 :
/:final_status = "Request status not supported" add "\n";
break;
case 0 :
/:final_status = "Connection to server has been made" add "\n";
break;
case 1 :
/:final_status = "Connection is being established" add "\n";
break;
case 2 :
/:final_status = "Pending request, contacting network" add "\n";
break;
case 3 :
/:final_status = "Pending request, resolving domain" "\n";
break;
case 4 :
/:final_status = "Failed, network error" add "\n";
break;
case 5 :
/:final_status = "Failed, couldn't reach server" add "\n";
break;
case 6 :
/:final_status = "HTTP error" add "\n";
break;
case 7 :
/:final_status = "DNS failure" add "\n";
break;
case 8 :
/:final_status = "Request has been fulfilled" add "\n";
break;
case 9 :
/:final_status = "Request timed out" add "\n";
break;
case 10 :
/:final_status = "No HTTP request has been made" add "\n";
break;
gotoAndStop("error");
}


Further Reading

Oxygen_Toolkit

--Narendar Raul

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fImgBoE78E5fcomponentE5fforE5fFlashE5fE4citeX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZflashQ qfnZtopicQUqfnTopicZflashE5fliteQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ