Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using Stage3D to create some 3D app in Flash. One of the items on my list is the ability to take a screen shot. Flash makes it easy to grab the stage content, but I can't find a way to grab the stage3D content. In DX I just used D3DXSaveSurfaceToFile. Anyone know of a way to do it in as3 and flash 11?

share|improve this question

The drawToBitmapData method of your 3d context (Context3D) should do what you want. Here are the API docs for said method.

share|improve this answer
Thx, still trying to figure out how I overlooked that... now to over come the next obstacle. It appears I can only call this just before I do a context3D.present(). Otherwise I get an error "All buffers need to be cleared every frame before drawing". So I can set a flag from a button to only capture the screen that frame. But then I have to generate a new user event because FileReference.Save can only be call directly from an Event, not programatically. – Robert Flesch Jan 14 '12 at 23:18
@RobertFlesch Well, you could set a flag when the user presses the "capture screen" key, store the next frame to a bitmap object, play a fancy sound effect and then present the user a nice modal dialog with a thumbnail of the image and a Save to disk and Discard button ;) – bummzack Jan 14 '12 at 23:41
Its putting lipstick on a pig, but I can see you understand the issue. And might as well make the pig look as pretty as you can! One more thing, in the screen shot I capture, it looks like it has no lighting, all the textures appear full bright. Any clues on that? – Robert Flesch Jan 15 '12 at 3:44
@RobertFlesch That's really strange. You should invoke drawToBitmapData just before you do context3D.present(). If that's the case, then I don't know what the issue could be. – bummzack Jan 15 '12 at 11:17
Maybe you could fire off your render procedure when the filereference event occurs? Or if you've rendered your entire output to a frame buffer, it would be very simple to just re-draw that frame buffer .... – ansiart Jul 16 '12 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.