AnimatedGifLoader Flex Component
There are some open-source alternatives to load animated gifs in Flash/Flex projects. Please see the following links:
http://www.bytearray.org/?p=95
http://labs.flexcoders.nl/2007/08/30/another-bytearray-fxc-mixfxcloader/
This component allows you to load animated gif files into your Flex applications. It’s as simple as that. You use it just like you use the SWFLoader or the Image components included in the Flex framework.
Last updated: 05-22-2007
This is a commercial component – Cost: $50
The AnimatedGifLoader is for sale for $50. This will get you the compiled SWC file that you can drop into your Flex project. You will also receive any updates to the component if there are bugfixes or added functionality. Read on to learn more about this component.
What is the component?
The AnimatedGifLoader is very similar to the SWFLoader component that is included in the Flex framework. It does everything the normal SWFLoader does, except it also loads animated GIFs. It includes the same api and adds a few new methods and variables:
New Properties:
- autoPlay — A Boolean to indicate whether the animation should start playing immediately. If false, the animation will load and pause on the first frame. Read-write.
- playing — A read-write Boolean that tells you if the animation is playing. If you set this via Actionscript it will either play or pause the movie. Bindable.
- currentFrame — A read/write variable that tells you what frame the animation is on. Bindable.
- delay — An optional Number to allow you to specify the delay in milliseconds between frames. If left unset this will use the delays between each frame that are specified within the GIF file
- frames — An ArrayCollection of Bitmap objects for each frame of the animation. Bindable.
Other than that it’s just like SWFLoader. You specify the source attribute and it loads the GIF. You can use it inline in MXML or with Actionscript.
Documentation
Documentation is included with the component and can also be viewed online here.
Test it out
There are two ways you can test this component. You can download an executable Apollo application that uses the component. This application will allow you to browse your hard drive and load a folder that contains animated gifs. The Apollo application uses the AnimatedGifLoader component, so if your animated gif plays correctly in the Apollo application then it will work in a Flex/Apollo app that you create.
Download the Apollo installer here.
Note: you must have installed the Apollo runtime to use this .air file. Download it here if you don’t already have it.
The other way to test this component is to download a demo version of the SWC file that you can use in your own Flex project. The demo version of the component works exactly the same way as the commercial version, except it draws red X’s over the frames of your gif animation. That will allow you to test adding the component to your Flex project and using it with your gif animations. Then if you are satisfied with the component you can purchase the full version.
Download the demo component here.
Examples
Here’s an example of loading an animated GIF using the AnimatedGifLoader component, compared with the normal SWFLoader component. You can see that the AnimatedGifLoader actually plays the animation and gives you some control over the playback. The SWFLoader on the right loads the same file, but it only displays the first frame.
And some more animated gifs:


Entries (RSS)