Put the following on your main guy:

//Run this every new frame.
onClipEvent(enterFrame){

//If we're holding down left
if(Key.isDown(Key.LEFT){
//If we just pressed right
if(lastdown=="right"){
//Insert whatever running script you have here.
}
//we just pressed left.
lastdown="left";
}

//If we're holding down left
if(Key.isDown(Key.RIGHT){
//If we just pressed left
if(lastdown=="left"){
//Insert whatever running script you have here.
}
//we just pressed right.
lastdown="right";
}

}

See it more clearly?
Ignore the meaningOfLifeX btw. that's just my sig.