Button controls using error

am Creating flash game in as2 its an fire game fire controls in space button.if i press the button the back bg move if the of end of the screen repress the space bar the back bg moves how can stop the back bg move in after pressing the fire