첨부한 파일을 다운 받아서 프로젝트에 넣어주시구요.
(출처 : http://flexology.wordpress.com/2008/09/30/loadinganimated_gif_in_flex/ )
AnimatedGIFImage.as 파일을 추가합니다.
소스는 아래와 같습니다.
package gif
{
import flash.net.URLRequest;
import mx.controls.Image;
import mx.core.UIComponent;
import org.gif.player.GIFPlayer;
public class AnimatedGIFImage extends Image
{
private var _gifImage:UIComponent;
public function AnimatedGIFImage()
{
super();
this._gifImage=new UIComponent();
}
override public function set source(value:Object):void
{
if (!value is String)
{
throw new ArgumentError("Source must be of type String");
}
super.source=value;
}
override protected function createChildren():void
{
super.createChildren();
var player:GIFPlayer=new GIFPlayer();
player.load(new URLRequest(this.source as String));
this._gifImage.addChild(player);
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
this.addChild(this._gifImage);
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
}
}
그리고 사용하실땐
<gif:AnimatedGIFImage source="test.gif" width="100" height="100"/> 와 같이 사용하시면 됩니다.