Prob with AS

im trying to make a custom cursor that when it hits a wall it bounces off and i cant seem to get the right AS. ive got the cursor and i can write AS for a hittest.
ive typed in

onClipEvent(enterFrame) {
Mouse.hide();
startDrag(this,true);
}

for the cursor and that works fine and ive typed in this on the cursor’s AS for the hitTest and it doesnt seem to work

onClipEvent(enterFrame) {
if (this.hitTest(_root.wall)) {
this.stopDrag();
}
}

i cant seem to get it working so if someone could help me it would help
thanks in advance