1

I need to capture whats currently shown in my app and save it as a image, is a flash app running locally, without apache, just a flash app with AS3, is it possible?

Ive seen many solutions googling but all need a webserver and this app is running as a desktop app.

Thanks in advance.

Juan Techera
  • 1,192
  • 2
  • 14
  • 25
  • Why did you accept your own (incorrect) answer, even though Juan actually answered the question correctly? – timrwood Jun 15 '10 at 17:59
  • Because i didnt find any encoders that allows to save to disk directly, if Juan or anyone points me in the direction of a encoder or any solution that does what i explained (no server side script involved just the flash 10 player and AS3 scripts) im gonna accept that answer. – Juan Techera Jun 16 '10 at 03:52

3 Answers3

3

Yes, it's possible.

Draw some display object to a BitmapData (the stage, for example) and crop it if neccesary (the second param of BitmapData::draw will help you out here).

Then, convert the raw pixel data to JPEG or PNG using some encoder. I'm sure up to this point, this is what those tutorials will explain you how to do.

Now, the third step is different but simple enough. Instead of sending the image data to a server side script, use a FileReference object. Since Flash Player 10, it has a method called save, that prompts the user to save a file locally.

Since this is a desktop app, you could also make it an AIR app. This will give more direct access to the file system and other features, in case you need them.

Juan Pablo Califano
  • 12,213
  • 5
  • 29
  • 42
0

After hours of research this looks like it isnt possible for some security restrictions of the flash player. All methods need some server side script to do it. The closer to what i needed was this but it needs apache or similar so it seems to be impossible to do in a standalone flash app

Juan Techera
  • 1,192
  • 2
  • 14
  • 25
0

There is a helper class that can grab the current visual state of a graph of DisplayObjects (actually, anything that implements IBitmapRenderer) and saves it out as bitmap data. That class is mx.graphics.ImageSnapshot.

Tim Keating
  • 6,443
  • 4
  • 47
  • 53