You can give the player an instance variable, such as a boolean that is either true or false. Call it something like onFloor.
If you press spacebar, set it false. If player collides with floor, set to true. If player walks off floor without jumping, set it false. You'd also check to see if onFloor is true to determine whether to allow player to jump. You'd also need to implement some events to check whether player overlaps with floor, so that you can set variable true or false.