Need help with sword attacking

i need to know an equation to make my character attack, the character is a sprite movie clip and i need to know how to make him attack both ways. This is very important so if you can help please do.