That would go in the event sheet editor. Equations don't work anywhere outside of conditions and actions. The proper place to implement it would be in your "Key is down" events. There you could set the proper animation as well as the speed with the equation I gave you.
Anyways, I went ahead and whipped up a quick CAP illustrating all the things you've asked about so you could see how it can all go together. It shows the mirroring of the sprite, the sliding, and the animation speed.
I hope all of this has helped you.