tags:

views:

593

answers:

3

Hello i need to extract frame (can be every number ) from flash swf and convert it to jpg/png/.. programmatically what is the best way to do that ? never mind the programming lang

A: 

Easiest solution would be to use a free screen capture program such as CamStudio.

Gary Green
He said *programmatically*...
Camilo Martin
A: 

Check out swfextract, part of swftools. It's a console app so you can easily drive it from your own software.

Paul Dixon
great tools , but i need the option to do it on remote swf file i didnt found any way to do that
If it's remote, then you need to retrieve the swf from this remote location, then process it!
Paul Dixon
Note that swfextract doesn't actually render the frames to images. Yes, it can extract existing images from flash, but if you're just extracting vector animations it just extracts as a new flash file.
John
+1  A: 

Do you have the original .fla files or only the .swf ones?

Anyway, if your using Actionscript 3, then every instance of DisplayObject and its subclasses (Stage, Sprite, MovieClip...) can be captured to a Bitmap. To do that, create a BitmapData object and use its draw method.

It would look like something like this:

do {
    bitmapData.draw(someMC);
    //then send the data to some server-side page
    //using getPixel or some other solution
    someMC.nextFrame();
} while (someMC.currentFrame =< someMC.totalFrames)

For more info on how to transfer the image to a server-side page check this: http://www.sephiroth.it/tutorials/flashPHP/print_screen/index.php

If you only have the swf file, you can try to load it inside your own swf and run the above code.

facildelembrar
Thanks , does it support remote swf file loading ? that is from remote url ?
Yes, however, flash has some security restrictions when loading swfs from different domains. You have to check the API for each method and see if they throw a SecurityError.
facildelembrar
Just checked and the draw method does throws a SecurityError, so you have to transfer the remote swfs to the same domain as the one you're running the loader.
facildelembrar