
Код:
MovieClip.prototype.dragEasing = function(handCursor) {
// control hand cursor
(handCursor == "") ? this.useHandCursor=true : this.useHandCursor=handCursor;
this.xfinal = this._x;
this.yfinal = this._y;
// on press drag
this.onPress = function() {
//Flag
createEmptyMovieClip("gg_mc",1);
duplicateMovieClip(this, gg_mc, 2);
//bring to front
//trace(this["gg_mc"]);
//mx.behaviors.DepthControl.bringToFront(this);
this.arrastrar = true;
this.xd = this._x-_root._xmouse;
this.yd = this._y-_root._ymouse;
//on enterframe move the mc with easing
this.onEnterFrame = function() {
if (this.arrastrar == true) {
this.x = _root._xmouse+this.xd;
this.y = _root._ymouse+this.yd;
} else {
this.x = this.xfinal+this.xd;
this.y = this.yfinal+this.yd;
}
this._x = this._x+(this.x-this._x)/3;
this._y = this._y+(this.y-this._y)/3;
// end of easing
if (Math.abs((this.x-this._x)/3)<0.5 && this.arrastrar == false) {
delete this.onEnterFrame;
}
};
};
// on release set the end point
this.onRelease = this.onReleaseOutside=function () {
removeMovieClip(gg_mc);
this.arrastrar = false;
this.xfinal = _root._xmouse;
this.yfinal = _root._ymouse;
};
};
gg.dragEasing();
gg1.dragEasing();
gg2.dragEasing();
gg3.dragEasing();
drag.zip
Мне надо чтобы при нажатии на MovieClip делался его дубликат, а при onRelease он удалялся. в чем ошибка?