3 Replies Latest reply on Sep 6, 2011 7:11 AM by calmchessplayer

    Find out the connection lost


      I have done the application with two type of authentication


      First one is the presenter

      Second one is the viewer

      (both are connect to the same FMS application)


      i want to notify the viewer when presenter log out or connection lost , how it's possible, please help me, thanks in advance

        • 1. Re: Find out the connection lost
          calmchessplayer Level 3

          NetStatus event listener. Its in the AS3.0 live docs.

          • 2. Re: Find out the connection lost
            JayCharles Level 4

            You'll need to keep track of the two clients on the server side, and invoke a client side method on the viewer client when the presenter disconnects. For example:


            On the viewer, you'll have a method in the netconnection's client object:


            onPresenterDisconnect = function(){

            // Notify the client here



            on the server side:


            application.onDisconnect = function(client){

            // Test to see if the disconnecting client is the presenter

            if(client is the presenter){

            // Loop through the client list to find the viewer or viewers

            for(var i=0; i<application.clients.length; i++){

            if(application.clients[i] is a viewer){

            application.clients[i].call("onPresenterDisconnect" null);





            Obvoiously, the above is not complete code. You'll need to add your own logic to determine whether a given client is a presenter or a viewer.

            • 3. Re: Find out the connection lost
              calmchessplayer Level 3

              oh yeah I was a little hasty on this one sorry. I would probably have an object on the server side that tracks all users and have an attribute that denotes presenter or subscriber. something like


              //intialize in onAppStart

              this.adminObj = new Object();



              //get user data from connection string on client side



              //add username in onConnect to Object




              //call this from client side depending on whether the user chooses to be presenter or subscriber.

              Client.prototype.setStreamID = function(userName,streamType){


              this.userObj[client.userName].streamID = streamType;



              //find out onDisconnect what type the client is.

              //application.onDisconnect = function(oldClient)

                //then either send or call the subscribers


              //This is imperfect just an example of how I might go about it.........I've also have tracke FPS on the client side to see when the presenter stops presenting. to track frames per second though you need to continously poll the fps property of the netstream with either a timer or onEnter (onEnterFrame).