If the animation frames start with right then go clockwise this formula will work:
round(angle(.x, .y, mousex, mousey)/45)%8+1
You can also setup animation angles so that when you point an object to a point construct will automatically select the closest angle.
Here is two ways to do it:
http://dl.dropbox.com/u/5426011/examples5/lookat.cap
made in cc1.2