Help me with shooting crab plz

i looked at the shooting crab tutorial but changed the crabs code on the first line:

on (keypress “<right>”) {
_root.fire = 1;
_root.i += 1;
duplicateMovieClip(_root.bullet, “bullet”+i, i);
}

so if i press toward the right the crab shoots.

i would like to know 1. how to make the crab fire if i press spacebar
2. if i hold in fire why does the bullet keep starting again at the crab