AS3 GIF Player

June 23rd, 2008 | No Comments | Posted in APNG, AS3

I came across a great post at ByteArray.org where Thibault Imbert was discussing one of his new AS3 experiments, the AS3 GIF Player Class 0.2. As you may already know, it is not possible to load animated GIF’s into the player. If you load a GIF file with the flash.display.Loader class you will only get the first frame of the animation.

this has all chanegd with the GIFPlayer class!

To load an animated GIF :

// we create the GIFPlayer, it plays automatically by default
var myGIFPlayer:GIFPlayer = new GIFPlayer();
// we show it
addChild ( myGIFPlayer );
// we load a gif file
myGIFPlayer.load ( new URLRequest ("animation.gif") );
// you can also load any valid GIF stream (ByteArray)
//with the loadBytes method (version 0.2)
myGIFPlayer.loadBytes ( gifStream );
// listen for the IOErrorEvent.IO_ERROR event,
//dispatched when the GIF fails to load
myGIFPlayer.addEventListener ( IOErrorEvent.IO_ERROR, onIOError );
// listen for the GIFPlayerEvent.COMPLETE event,
//dispatched when GIF is loaded
myGIFPlayer.addEventListener ( GIFPlayerEvent.COMPLETE, onCompleteGIFLoad );
// listen for the FrameEvent.FRAME_RENDERED event,
//dispatched when a GIF frame is rendered on screen
myGIFPlayer.addEventListener ( FrameEvent.FRAME_RENDERED, onFrameRendered );
// listen for the FileTypeEvent.INVALID event,
//dispatched when an invalid file is loaded
myGIFPlayer.addEventListener ( FileTypeEvent.INVALID, onInvalidFileLoaded );
// get total frames
myGIFPlayer.totalFrames;
// standard methods
myGIFPlayer.play();
myGIFPlayer.stop();
myGIFPlayer.gotoAndStop(3);
myGIFPlayer.gotoAndPlay(3);

Here’s a sample from ByteArray.org . Please don’t load huge GIF files!

Online Demo :
***Click on Load GIF File and paste this in the path >> http://www.backspacestudios.com/beaker/GIFPlayer/diego.gif

Sources and documentation available at http://code.google.com/p/as3gif/

Tags: ,

APNG Update

December 9th, 2007 | No Comments | Posted in APNG

Development of the APNG microsite is underway. We hope to have the site up before the end of the week.

I will be holding another training ATS ( APNG Training Session ) later this month. Untill then here are a few good links to get you started.

http://labs.mozilla.com/2007/08/better-animations-in-firefox-3/
http://wiki.mozilla.org/APNG_Specification
http://littlesvr.ca/apng/apngedit.html
Also see http://phug.ca/index.php/apng-assembler-andrew-smith/

Here are a few samples contributed by PHUG members.
You will need a Firefox 3 beta or Gran Paradiso to view the APNG files.

daniel_coltri01.png

daniel_coltri02.png

william_wong01.png

APNG Training Session

December 3rd, 2007 | 3 Comments | Posted in APNG

apng05.jpg

PHUG (PHP Toronto User Group) , a Toronto based online community, is helping contribute to the APNG open source project in conjunction with Seneca College of Applied Arts and Technology - School of Computer Studies.

APNG (Animated PNG) is a new format based on and compatible with the PNG format. It was developed to overcome technical limitations of Animated GIF’s. The APNG and PNG specs are not legally encumbered.

PHUG will be putting together an APNG showcase site that will demonstrate the power of this new format.

BackSpaceStudios has offered to help train members of PHUG to use the new APNG editor with Mozilla’s Gran Paradiso browser. training session began this evening at Seneca College with about 30 members in attendance.

We will be holding another training session tomorrow Dec 4th at 6pm, Seneca College of Applied Arts and Technology York Campus RM2046.

For more information on APNG:
http://littlesvr.ca/apng/demo.php
http://labs.mozilla.com/2007/08/better-animations-in-firefox-3/
http://zenit.senecac.on.ca/wiki/index.php/APNG

Pictures from the Training session

apng051.jpgapng04.jpgapng03.jpgapng02.jpgapng01.jpg