Something like this should work:
Give your sprite an instance variable..
on left arrow pressed - set instance variable direction to "left"
on right arrow pressed - set instance variable direction to "right"
sprite compare variable is "left"
- set animation to "idle left"
etcetera..