All I'm doing on that if statement is making sure the frame number I set can't go above the max frames in the animation (3).
The AnimationFrame property is 0 based so my three frames are 0, 1, 2.
AnimationFrameCount, like any count field will return the literal number of items, so it'll tell me there are 3 frames. I can offset this by -1 to ensure I'm checking the last actual frame number has hit my max frames.
In this case AnimationFrameCount-1 = 2.
If my sprite is already on frame 2, I don't want to add 1 as frame 3 doesn't exist. So instead I go back to the start i.e. frame 0.
In any other situation I'm happy to add 1 to the frame, so I just catch that in an ELSE.
This approach means my code will work no matter how many frames are in my animation. I never use hardcoding if I can help it.
You should also go through the tutorial if you haven't yet, it's a good start.
scirra.com/tutorials/37/beginners-guide-to-construct-2