Attacks in video game?

I’m contnuing on the game i did on flash and im trying to make the guy attack when i press spacebar. wat i did was for the guy 's walking anim i double cllicked on the movieclip and edited the frames so every time he walks it animates, and for the attack anim i made a new layer and made a attacking anim on it but when i play the game the guy wont attack when i press spacebar but when i move around it plays both the walking and attack anim at once. and i dont know wat to do.
help plz