When loading a graphic for a FlxSprite
, you can specify is as an animated graphic. Then, using animation
, you can setup animations and play them.
// sprite's graphic will be loaded from 'path/to/image.png' and is set to allow animations.
sprite.loadGraphic('path/to/image/png', true);
// add an animation named 'run' to sprite, using the specified frames
sprite.animation.add('run', [0, 1, 2, 1]);
// play the 'run' animation
sprite.animation.play('run');
In the Demonstration, we are loading this image: