Converting SWF into GIF file - actionscript-3

I have a flash file where I load a remote SWF file into my own. Now what I want to do is convert that remote SWF file into a GIF that I can save onto my server.
The remote file is a SWF that has a variable amount of frames, and I somehow need to be able to figure out the amount of frames (I presume), and take a snapshot (picture) of every frame, to turn the taken pictures into a GIF file. That's what I THINK has to be done, however I have no idea if it's even possible to take pictures/snapshots of remote SWF files.
I need some serious suggestions on how I could get this working. I'm a serious Flash newbie, and anything would help.

Trying to capture stage area using BitmapData
var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
bmd.draw(stage);
And this should help you creating the animated GIF:
http://www.bytearray.org/?p=93

You can use the totalFrames property to see how many frames there are and loop through them. You can draw the frames into a BitmapData object.

Related

Extract all png file and bitmap data from swf using as3

Is there any way to get a list of bitmap resource (eg png file) using as3? I know that I can go through the all child of the swf and check if each child is a shape or not, if yes, then I can get back the bitmap data by
var bmd:BitmapData = new BitmapData(obj.width, obj.height, true, 0);
bmd.draw(obj);
and then write out the bmd as a png file. However, by doing this I cannot know which png resource this object associate with, also if the object instance is inside an animation, this approach may not successfully capture the bitmap data correctly. Any better idea?
I believe you can play with these libraries as3swf (as3swf is a low level Actionscript 3 library to parse, create, modify and publish SWF files.) and Velocity 9 SWF Inspector (A handy little tool to peek inside SWF files)

Exporting AS3 animation to FLV using AS3

Is it possible to export an animation consisting of AS3 etc etc into a FLV file type using AS3 Code to do it rather than using manual progression
File > Export etc etc
Thanks
Aiden
It is a long shot, but depending on the conditions (CPU power, resolution, memory) it could work.
You should be able to make a BitmapData for every frame in your movie using bitmapData.draw(displayObject);. Then store all those bitmaps in an array, and then encode to flv using some external library such as this one.
Here's a tutorial on how to convert a displayObject into a BitmapData.
If instead of using Flash Player you compile to Adobe Air for desktop, you could save the frames as files in the hard drive, and then encode the sequence using a multitude of programs (such as After Effects) to any video format you want.
You can look into this codebase, it may save you some time:
http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs/
var myWriter:SimpleFlvWriter = SimpleFlvWriter.getInstance();
myWriter.createFile(myFile, 320,240, 30, 120);
myWriter.saveFrame( myBitmapData1 );
myWriter.saveFrame( myBitmapData2 );
myWriter.saveFrame( myBitmapData3 ); // ... etc.
myWriter.closeFile();

flash. AS3. Save NetStream to a local file?

I want to ask how to save video and audio content that I'm loading from some site through a NetStream as an FLV file.
Is there any possible way to do this?
var ns:NetStream = new NetStream(nc);
ns.play('http://somefile.com/file.flv');
var file:FileReference=new FileReference();
**ns.doSomething(file); /// ???**
file.save(data,"flvfile.flv");
I don't think you can do this with NetStream - it doesn't necessarily hold the entire file at any one time.
Why not just point the file reference to 'http://somefile.com/file.flv' - open that, then grab the data from it and save that with another reference once it has completed downloading? You can either run the NS in parallel as a separate operation, or open the NS from the local disc once it has finished downloading.
There's a good answer regarding downloading directly using a FileReference, and the gotchas it involves, here: Flex 3 file download - Without URLRequest

Is there any method in as3 that flash can write file's last modified date

Is there any method in as3 that flash can write file's last modified date.
Its stand alone flash application which had external swf loading. I want to check the last modified date of the swf during the loading.
please suggest any possible methods.
Thanks.
In AIR, there is File class with modificationDate property. But in plain AS3, there's no file concept at all. If you loading swf with Loader, you only get data, but not the attributes of file (and file might not exist at all if loading something by URL.)

Code-generated SWF to FLV

I need to convert a swf movie that is created entirely through code (with the help of TweenLite) to a .flv format. The issue here is that I need to 1) Do this as a batch process, and that 2) since the swf is entirely generated by code it only has 1 frame and as such normal conversions like from CS5.5 to to the .avi format give me just 1 frame in the resulting video format. Is there a free converter out there that can get past the fact that my video is technically only 1 frame long and can handle batch jobs? Thanks for all your help
Sounds like you could implement a JSFL extension if you have a copy of Adobe Flash or a trial from their site. It basically adds a command to publish multiple folders and sub folders.
http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1021887