0 Replies Latest reply on Apr 22, 2009 2:06 AM by mkayyali

    NetConnection and "disconnection"

    mkayyali Level 1

      Dear,

      I have air project and am using NetConnection on it and its working GREAT, my question is:-

       

      when the air file is working in the client user and the server disconnect or restarted, the connection failed in client side and no error occurred as i detect only if there is any error on not on starting the application [ m_connection.addEventListener(IOErrorEvent.IO_ERROR, error); ] so... i need to addEventListner for if the connection failed in any time between the air application and the server side to detect it and handle the error to make the client side informed that was a error in the server...

       

      Thanks a lot

       

      my code:

       

      function completeHandler():void {

      m_connection = new NetConnection();

       

      m_connection.addEventListener(IOErrorEvent.IO_ERROR, error);

      m_connection.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);

       

      m_connection.client=this;

      m_connection.objectEncoding=ObjectEncoding.AMF0;

       

      m_connection.connect(siteURL,userName);

      }

      completeHandler();

       

      function netStatusHandler(event:NetStatusEvent):void {

      switch (event.info.code) {

      case "NetConnection.Connect.Success" :

      break;

      case "NetConnection.Connect.Failed" :

      this.winError.play();

      break;

      }

      }