GIF图片,加载到Image后,不能动起来,需要把 gif 转换成 swf ,才可以。
可以使用GIFPlayer 0.4.zip 来解决这个问题。 下载地址:http://code.google.com/p/as3gif/downloads/list
下载后,把org下所有目录及文件拷到工程下,即可。 The GIFPlayer class is used to play the gif animation. It can load gif file from an URLRequest object or a ByteArray object. Example: The GIFEncoder class use to create a gif file by frames. Example(draw two frames and add to GIFEncoder then play the gif data by GIFPlayer): extendsSprite { publicfunctionMain():void { var frames:Array= createFrames(); var encoder:GIFEncoder=newGIFEncoder(); encoder.setRepeat(0); //AUTO LOOP encoder.setDelay(500); encoder.start(); //MUST HAVE! encoder.addFrame(frames[0]); encoder.addFrame(frames[1]); encoder.finish(); //MUST HAVE! playGIF(encoder.stream); } privatefunction playGIF(data:ByteArray):void { data.position =0; var player:GIFPlayer=newGIFPlayer(); player.loadBytes(data); addChild(player); } privatefunction createFrames():Array { var shape:Shape=newShape(); shape.graphics.lineStyle(1,0); shape.graphics.moveTo(60,0); shape.graphics.lineTo(60,120); var frame1:BitmapData=newBitmapData(120,120); frame1.draw(shape); shape.graphics.clear(); shape.graphics.lineStyle(1,0); shape.graphics.moveTo(0,60); shape.graphics.lineTo(120,
可以使用GIFPlayer 0.4.zip 来解决这个问题。 下载地址:http://code.google.com/p/as3gif/downloads/list
下载后,把org下所有目录及文件拷到工程下,即可。 The GIFPlayer class is used to play the gif animation. It can load gif file from an URLRequest object or a ByteArray object. Example: The GIFEncoder class use to create a gif file by frames. Example(draw two frames and add to GIFEncoder then play the gif data by GIFPlayer): extendsSprite { publicfunctionMain():void { var frames:Array= createFrames(); var encoder:GIFEncoder=newGIFEncoder(); encoder.setRepeat(0); //AUTO LOOP encoder.setDelay(500); encoder.start(); //MUST HAVE! encoder.addFrame(frames[0]); encoder.addFrame(frames[1]); encoder.finish(); //MUST HAVE! playGIF(encoder.stream); } privatefunction playGIF(data:ByteArray):void { data.position =0; var player:GIFPlayer=newGIFPlayer(); player.loadBytes(data); addChild(player); } privatefunction createFrames():Array { var shape:Shape=newShape(); shape.graphics.lineStyle(1,0); shape.graphics.moveTo(60,0); shape.graphics.lineTo(60,120); var frame1:BitmapData=newBitmapData(120,120); frame1.draw(shape); shape.graphics.clear(); shape.graphics.lineStyle(1,0); shape.graphics.moveTo(0,60); shape.graphics.lineTo(120,