2 Replies Latest reply on May 10, 2006 4:11 PM by tonyhigham

    Protoyping problem

    tonyhigham Level 1
      when prototyping an existing class, for example:

      Array.prototype.myMethod = function():Void{
      //Perform some action here
      }

      for...each loops return the new method, for exmple, after the previous prototype has been declared:

      my_arr = new Array[1,2,3]
      for(i in my_arr){
      trace(i)
      }
      should return '2,1,0' but instead returns 'myMethod,2,1,0'
      this means that it will now be impossible to loop through an array in this way without first knowing, and then accounting for any protoypes that have been declared.
      is there anything wrong with this prototype declaration that is causing this behavior? any help is much appreciated....