优化后的代码
override public function addElement(e:BasicElements):void {
var i:int = this.aElements.indexOf(e);
//i如果等于-1说明aElements中不含有e
if ( i< 0) {
this.aElements.push(e);
}else {
this.aElements.splice(i, 1, e);
this.aElements.push(e);
}
//this.aElements.push(e);
}