3 Replies Latest reply on Jan 11, 2008 7:12 AM by Greg Dove

    array pop

    Level 7
      Hi,

      I want to remove an element of an array. With the pop command I can
      remove the last element of an array. But what should I do to remove an
      array inside an array?

      I tried to duplicate the array manualy an then copy it, but I guess the
      problem is that I just copy the reference of the new array and then the
      data gets lost. Do I have to duplicate it manually again? What is the
      best way?

      function remove(obj){
      var newList = []
      var element;
      var elNum = 0;

      for (n in _global.carList){
      element = _global.carList[n];
      if (element != obj){
      newList[elNum] = element;
      }else{
      trace("removed " + element);
      element.inCarList = 0
      element.radar_mc._visible = 0;
      }
      }

      _global.carList = newList;
      }