title: I need to ping a website with ActionScript or Animate
body: <p>I had found this code ( <a href="https://stackoverflow.com/questions/5907783/i-need-to-ping-to-an-network-with-flash-or-actionscript">I need to ping to an network with flash or actionscript</a> )
  Im not sure i understand it or how to use it exactly - I need for this to redirect to another frame if it worked and another if it failed</p>
  
  <p>Is anyone able to help?</p>
  
  <pre><code>    var ldr:URLLoader = new URLLoader();
  ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, ldrStatus);
  
  var url:String = "URL-TO-SITE";
  var limit:int = 10;
  
  var time_start:Number;
  var time_stop:Number;
  var times:int;
  
  ping();
  
  function ping():void
  {
      trace("pinging", url);
  
      times = 0;
      doThePing();
  }
  
  function doThePing():void
  {
      time_start = getTimer();
      ldr.load(new URLRequest(url));
  }
  
  function ldrStatus(evt:*):void
  {
      if(evt.status == 200)
      {
          time_stop = getTimer();
          trace("got response in", time_stop - time_start, "ms");
      }
  
      times++;
      if(times &lt; limit) doThePing();
  }
  </code></pre>