i wrote a function that attaches a MC that is dragged and tests a hittest for a new location. and it almost works the way i want.but can any bodey explain to me why
only _root.mouseDown works and targetClipbtn.mouseDown doesnt?
and why when i add the second part of the code _root.onMouseUp nothing works?
(i put all the code…)
function rope() {
//creating and attaching an mc(ropeBtn) to it in order to drag it
this.createEmptyMovieClip("targetClipbtn", 1);
this.targetClipbtn._x = 143.45;
this.targetClipbtn._y = 83.5;
this.targetClipbtn.attachMovie("ropeBtn", "ropeBtn11", 1);
//finding th x and y of the mouse and compareing it to my MC with(hitTest)and start dragging
_root.onMouseDown = function() {
mxx = _xmouse;
my = _ymouse;
if (this.targetClipbtn.hitTest(mxx, my, true)) {
this.targetClipbtn.startDrag();
//comparing with the new location
onMouseMove = function () {
if (this.targetClipbtn.hitTest(243, 127.25, true)) {
this.targetClipbtn.removeMovieClip();
}
};
}
};
}
rope();
_root.onMouseUp = function():Void {
delete (_root.onMouseDown);
delete (_root.onMouseMove);
updateAfterEvent();
};