
Loading Animated GIF in Flex
September 30, 2008Loading Animated GIF in Flex is something that has always been the most wanted thing for Flex Developers. Doug McCune has made a component, Animated GIF Loader which actually loads animated gif. But the only drawback is that it costs $50!
Here is a free solution. There is a free component AS3GIF. The example shown with the code was made in Flash CS3. I ported it for Flex. Here is a sample…
Run Demo
Download Source | [Google Pages Mirror Link] | [Freehostia Mirror Link]
***
P.S: As many of you have reported that the 10gbfreehost link doesn’t seem to work, I have added a few other mirrors where I have uploaded the source zip file. One of them should definitely work!
many thanks for the code! I have been looking for a cheaper alternative to AS3Gif for a long time!
Thank you for a very helpful feature.
I know almost zero about GIF file formats, so this is probably my error, but I thought I’d pass it along in case there is some debugging to be done.
01. I found a gif file which looked pretty good, but did not really have the correct encoding for transparency, so the rotations were a bit ugly around the edges.
02. I found some old software from Jasc that supports creation of animatied gifs, so I used it to clean up the transparency problem. Now, however, the rotations, while clean around the edges, did not properly transit from image to image.
03. I found some code in your readHeader routine that relate to ‘dispose’ methodology. The first file — the one that sort of worked, but was ugly — had 8 frames all coded 1. The second file — the one with improper bitmap transitions was coded as dispose = 2 on the first 7 frames and 1 on the final frame.
04. Blindly knowing nothing, I forced your code to treat all 8 frames as dispose mode 2, and then the transitions were correct. I’m sure my ‘fix’ is not generically correct at all, but I think the use case with a dispose mode 1 at the end of previous dispose mode 2 frames will always fail because of some logic I swiftly passed by which carries the ending disposal mode forward to the start of the next loop.
[...] Flex, How to load animated GIFs using Adobe Flex By goelnitin http://flexology.wordpress.com/2008/09/30/loadinganimated_gif_in_flex/ [...]