Hi
In the following code I am trying to call the function pressMc when movieclip myMC_mc is pressed and the apply the drag action to it. However the drag action is being applied to the whole of level0 and therefore all of the moviclips. I am not sure why. Am using the this key word as I would expect this to be identified as myMC_mc when the myMC_mc.onPress is evoked.
I want to write this as a function because I want to apply this drag action to lots of different movieclips
Anyone got and ideas
much appreciated
function pressMc (){
delete this.oldX;
delete this.oldY;
this.onEnterFrame = function() {
if (_xmouse>this.oldX || _xmouse<this.oldX) {
this.startDrag(false, 25, this._y, 125, this._y);
delete this.onEnterFrame;
} else if (_ymouse>this.oldY || _ymouse<this.oldY) {
this.startDrag(false, this._x, 25, this._x, 125);
delete this.onEnterFrame;
}
this.oldX = _xmouse;
this.oldY = _ymouse;
trace (this);
};
};
myMC_mc.onPress = function() {
pressMc();
};