Solved!
First, set up your character animations like this:
<img src="http://i42.tinypic.com/zbja1.jpg" border="0" />
0 = right
1 = down-right
2 = down
3 = down-left
4 = left
5 = up-left
6 = up
7 = up-right
You will do this for both idle and running animations, obviously.
Then set up events like this:
<img src="http://i44.tinypic.com/dmv4ea.jpg" border="0" />
The first set controls your key movements. The bottom commands control the animations.
For idle: "idle"&self.a
For running: ceil(8*(1+Player.8Direction.MovingAngle/360)-0.5)%8
and
"run"&self.a