Animation Loop throwing an error

When you'll get tired from build-in animation solution, please take a look at my AnimatedSprite class: