[ActionScript3.0] 为内建类添加方法时间:2023-03-09 01:31:27 通过使用prototype在继承内建类特性的同时加入新方法 Array.prototype.removeElement = function (item:*):void { var index:int = this.indexOf(item); if(index>-1){ this.splice(index,1); } } var arr:Array = [1,2,3]; arr.removeElement(1); trace(arr);//2,3