×
Namespaces

Variants
Actions

Archived:How to check network status in Flash Lite 1.1

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Article
Created: narender_raul (26 May 2008)
Last edited: hamishwillee (14 May 2013)

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

This page was last modified on 14 May 2013, at 09:12.
60 page views in the last 30 days.