/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * * @param $obj The object you want to delete elements from * @param parameters A comma delimeter parameters to be passed on the object for deletion, if a parameter is not found the object it will be skipped * @return The new object with the deleted element * */ public static function deleteElements ($obj:Object, ...parameters):Object { if ($obj != {} || $obj != null) { for (var s:String in parameters) { if ($obj[parameters[s]] && $obj[parameters[s]] != undefined) { $obj[parameters[s]] = null; delete $obj[parameters[s]]; } else { trace ("parameter,", parameters[s], "was skipped as it couldn't be found on the object"); } } } return $obj; }