1 Reply Latest reply on Mar 7, 2008 4:26 AM by Newsgroup_User

    Array slice

      I have this mc that i want its name to be added to an array and when that movie clip is deleted I also want that value in the array to be deleted also. How would I do this?
      Thanks for the Help.
        • 1. Re: Array slice
          Level 7
          I'd put the clip ref right into the array:


          and then:

          if(balive == wb){
          balive.splice(i, 1);

          Note splice(i,1) - not i, i+1 - the second param is the delete count... you
          want to delete one item. If you found the target at index 10, you'd delete
          11 items the way you had it.
          Also, when you do trace(balive.splice(i,i+1)) - you are tracing the result
          of executing that splice again... not what you want. If you look at the Help
          for array.splice you'll see it returns an array. If you want to know if
          something was deleted, trace the array's length before and after the splice.

          Dave -
          Head Developer
          Adobe Community Expert