I am trying to duplicate a MovieClip on the stage...then replace another clip on the stage with the duplicated clip...I almost have it . . . can anyone offer some guidance as to why this isn;t working...or maybe there is a better way.

PHP Code:
red.duplicateMovieClip("rectangle"1);
rectangle._xscale 200;
//
MovieClip.prototype.swapClip = function(idName) {
    var 
obj = {_x:this._x_y:this._y_xscale:this._xscale_yscale:this._yscale_rotation:this._rotation_visible:this._visible_alpha:this._alphaidName:idName};
    
this._parent.attachMovie(idNamethis._namethis.getDepth(), obj);
};
ASSetPropFlags(MovieClip.prototype, ["swapClip"], 1);
holder.swapClip("rectangle");
//MovieClip instance named my_mc will be replaced by another clip