Flash-Animated-GIF-Library is a fast and robust library for playing Animated GIFs. Its parser is quite strict, however, so if there is a GIF that works in the browser but not with this library it probably means the browser is being overly lenient with the corrupt image data.

The speed gains are achieved by specifically avoiding doing any pixel decoding at all and instead splitting and re-packaging each frame of the animation into its own freestanding gif file. The resulting single-frame GIF files are handled to Flash to decode the frame’s image data internally via the Loader class.


var player:GIFPlayer = new GIFPlayer();

player.smoothing = false;

player.addEventListener(GIFPlayerEvent.COMPLETE, handleGifLoadComplete);
player.addEventListener(AsyncDecodeErrorEvent.ASYNC_DECODE_ERROR, handleAsyncDecodeErrorEvent);
player.addEventListener(GIFPlayerEvent.FRAME_RENDERED, handleFrameRendered);

private function handleAsyncDecodeErrorEvent(event:AsyncDecodeErrorEvent):void {
	trace("GifPlayer: Async Decode Error Event: " + event.text);

private function handleGifLoadComplete(event:GIFPlayerEvent):void {
	trace("Gif load complete, adding to stage");

private function handleFrameRendered(event:GIFPlayerEvent):void {
	trace("Frame " + event.frameIndex + " rendred.");
Misc . URL.