views:

627

answers:

3

Hello All,

I was wondering if there is any way to use the "Export Movie" as "PNG Sequence" to work for movies where objects are animated with actionscript. Exporting like this works just dandy for normal animations, but it doesn't work for my current project. Basically I am creating images using mathematics and I want to be able to export the result as a png for use in other programs like photoshop; but since the images are created with actionscript the export just shows a blank image. Am I reduced to just taking a screenshot of the result and tediously removing all the should-be-transparent regions with the wand tool? Someone please tell me there is a better way; thanks!

A: 

As far as i know, exporting a movieclip will not run any actionscript, it will only output all frames and their (static) content.

I really dont know if it can be done and your screenshot solution seems the only one ..

Checkerforth
A: 

Use ActionScript's Socket class. Take a snapshot of the stage (using BitmapData class), and send it to another script running on your computer via a socket, where the picture is saved. I had to something like this using Python, and it worked great. For animations, you might not get the best frame rate. But it should be fine so long as the animation isn't time dependent.

An example of how you'd do this (untested):

var sock:Socket = new Socket(yourIP, somePort);
var drawRect:Rectangle = new Rectangle(0, 0, 550, 400);
var bmp:BitmapData = new BitmapData(drawRect.width, drawRect.height, true, 0x00000000);
bmp.draw(stage, null, null, null, drawRect);
var pixels:ByteArray = bmp.getPixels(drawRect);
for each (var pixel in pixels) {
    sock.writeUnsignedInt(pixel);
}

Note that you might need to put the last chunk in a "connect" Event. And also note that I'm still migrating to AS3, so some of that might be outdated.

Wallacoloo
Hmm; this is interesting as well.. does it have to be AS3 or can you do this in AS2 as well (currently in AS2 but can switch if needed i suppose.
Yes, I originally did this in AS2 (but I think Socket would be replaced with XMLSocket).
Wallacoloo
I went with the solution above but this one seems good to; thanks for the info. I would upvote this answer but I don't have enough rep yet. Thanks again.
+2  A: 

Since Flash CS3 you can export your actionscript animations/shapes as quicktime.

  1. Go to File > Export Movie > Quicktime
  2. In the Quicktime Export Settings pick After time elapsed instead of When last frame is reached.
  3. Tick Ignore Stage color(generate alpha channel).

You should be able to import the Quicktime movie in Photoshop Extended which since version CS3 has a Timeline(Window > Animation). In CS4 there is a Video Workspace which should help.

This seems the easiest method to me.

If you want to stick to more code, you could try Lee Felarca's SimpleFLVWriter ( it is a bit old though, so test first ) or make your swf into an AIR Application and use the the PNGEcoder from the Adobe AS3CoreLib.

Could you post your video on vimeo and share the link please(I wanna see ^_^) ?

Goodluck, George

George Profenza
Thanks George; I was trying the quicktime method and it exported perfectly; the problem is the transparent region is now not transparent; it records it as the background color of the swf. So this means I have to do the same thing as if I just took a screenshot; manually wand tool it out. Is there a way to do something similar to this while preserving transparency?
ooops, forgot step 3 Tick Ignore Stage color(generate alpha channel) :)
George Profenza
Oh wow, I'm an idiot; I was looking for something like that and somehow I just skimmed right over it. Anyway; thanks this is exactly what I need. Btw, this is actually for an iPhone app that I am working on so if your interest search up the company Omegasoft on the iTunes store and look for a new app appearing in a few weeks ;) Thanks again!P.S. I would upvote your answer but I don't have enough rep yet.