Skip to main content
Participant
September 30, 2009
Question

splice

  • September 30, 2009
  • 1 reply
  • 500 views

Hi Guys

can u please tell me why the splice function doesn't work and how i can delete this entry out of the array?

application.onAppStart = function(){
    application.allowDebug = true;
       
   
    application.chat_so = SharedObject.get("chat_so", false);
    application.ar = new Array;
   

    application.onConnect = function( client, username ) {
        application.acceptConnection( client );
        client.cl_id = new String;
       
        client.addUser = function (u_data){
            client.cl_id = u_data;
            application.ar.push(u_data);
            application.chat_so.setProperty("hi", application.ar);
        }
    }
   
    application.onDisconnect = function(client){
        for (i = 0; i < application.ar.length; i++){
            if (client.cl_id == application.ar){
                application.ar.splice(i,1);
                application.chat_so.setProperty("hi", application.ar);
            }
        }
           
           
       
    }
}

Thanks a lot

    This topic has been closed for replies.

    1 reply

    ghost31379
    Inspiring
    October 3, 2009

    errrr....for starters i dont think all the functions and madness you use in Actionscript is gonna work in FMS just the most common stuff.

    with that being said......just errr do something like this:

    application.onDisconnect = function(client)
    {

        application.chat_so.setProperty(client.name, null);

    }

    and they are deleted...or should be ...*crosses my fingers*.........thats it...i think

    thelegendaryghost