Having trouble in attacking

I want it to where when I press space a clip in a certain distance in front of me would be hit, with a simple knife thing.

This is the coding that I have for the character

onClipEvent (load) {
stop()
movespeed = 7;
stagewidth = 550;
stageheight = 400;
}

onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if(this.getBounds(_root).xMax < stagewidth) {
_x+= movespeed;
} else {
_x = stagewidth-(_width/2);
}
}
if (Key.isDown(Key.LEFT)) {
if(this.getBounds(_root).xMin > 0) {
_x-= movespeed;
} else {
_x =(_width/2);
}
}
if (Key.isDown(Key.RIGHT)) {
wasRight = true;
this.gotoAndStop(2)
} else if (Key.isDown(Key.LEFT)) {
wasRight = false;
this.gotoAndStop(3)
} else {
if(wasRight) {
gotoAndStop(1);
} else {
this.gotoAndStop(4);
}
}
}

I want an

if (Key.isDown(Key.SPACE)) {
at a close distance
if hit
then movie clip is gone

that kind of thing

can someone help me