public function removeItem(item:StoreItem):void {

    var i:uint;  //declares a local variable i of type uint (unsigned int)

    /*initialize *i* with the value *0*;
      until *i* is smaller than the collection's length, execute the code
inside the for loop and increment *i* by one at the end of each step (*i++*)
    */
    for (i=0; i < _collection.length; i++){

        //check if the item in the *_collection* array at position *i* is
equal to the *item* that was passed as an argument
        if (_collection [i]==item){

            //remove *1* item from the *_collection* array starting at
position *i*
            _collection.splice(i, 1);

            //since the item we were looking for was found, there's no need
to continue searching
            break;
         }

    }

}



Tibor.

Reply via email to