1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
/* on cree le variable */
_root.MC_Axpos=clipA ._x;
_root.MC_Aypos=clipA ._y;
_root.Xdiff=0;
_root.Ydiff=0;
_root.MC_Bxpos=clipB ._x;
_root.MC_Bypos=clipB ._y;
/* le code du clipA */
clipA .onPress = function () {
startDrag(this,false,0,0,(this.w-this._width),(this.h-this._height));
this.onEnterFrame = function () {
_root.Xdiff=this._x-_root.MC_Axpos;
_root.Ydiff=this._y-_root.MC_Aypos;
/* cette partie me permet de rendre le déplacement proportionnel*/
_root.Xdiff=_root.Xdiff/0.12;
_root.Ydiff=_root.Ydiff/0.12;
}
}
d.onRelease = function () {
stopDrag();
delete this.onEnterFrame ;
delete ClipB.onEnterFrame;
}
/*Action clip B */
Clip B.onEnterFrame = function () {
this._x=_root.MC_Bxpos-_root.Xdiff;
this._y=_root.MC_Bypos-_root.Ydiff;
} |