* Where did you read that the animation list is preserved? https://github.com/HaxeFlixel/flixel/blob/master/flixel/FlxSprite.hx#L345
Don't redo the animations when using loadGraphic again. The animations are not cleared when using loadGraphic, so it will still have any previous animations and will just play the same frame numbers but using the new graphic. When you do addAnimation, the animation is simply added to the end of the animation list, so if you were to add new animations each time you change graphic you would be adding the same animation again to the end of the animation array. No need.
Unique
Optional, whether the graphic should be a unique instance in the graphics cache. Default is false.
public function addWithSpaces(Graphic:Dynamic, FrameWidth:Int, FrameHeight:Int, SpacingX:Int = 1, SpacingY:Int = 1, Unique:Bool = false, ?Key:String):CachedGraphics
{
if (Graphic == null)
{
return null;
}
// (i've cut a bit , here comes interesting part)
if (Std.is(Graphic, CachedGraphics))
{
isGraphics = true;
graphic = cast(Graphic, CachedGraphics);
if (!Unique && (FrameWidth <= 0 && FrameHeight <= 0))
{
return graphic;
}
}