Flixel Power Tools FlxScreenGrab

Back to the Flixel Power Tools

This class allows you to take screen grabs of your game as it’s running. And then save that grab as a PNG locally. The screen grab process can be bound to a Hot Key, or called directly. You can control if the mouse pointer is hidden before capture or not, and you have full control over which part of the screen is captured. It defaults to the whole screen, but any rectangle region is valid (and can even be passed in real-time, see the Camera Test Suite example!)

Screen Shot

Code Example

Recent Flixel Power Tool Posts

  1. Flixel Power Tools v1.9 Released
  2. Flixel Power Tools v1.8 Released - Let's get clicky
  3. Flixel Power Tools v1.7 - Kaboom!
  4. Flixel Power Tools v1.6 released including FlxControl
  5. Flixel Power Tools v1.5 - A monster of an update!
  6. FlxScreenGrab and FlxScrollZone added to Flixel Power Tools
  7. Flixel Power Tools v1.3 - Now Flixel 2.5 compatible!
  8. FlxHealthBar added to Flixel Power Tools

4 Responses

Leave a comment
  • August 4th 2011 at 4:29 pm

    This seems to run afoul of Error 2176 in FP10: “Certain actions, such as those that display a pop-up window, may only be invoked upon user interaction, for example by a mouse click or button press.”

    Not sure why hitting F1 doesn’t count as a button press.

  • August 4th 2011 at 4:40 pm

    Sure it’s for using locally to grab from your game while running it. I’ll do an example at some point where it’s fired from a mouse event (that is why the sandbox security thing hits it)

  • September 23rd 2011 at 8:50 am

    Hi rich,

    I tried the sample above but it doesn’t seem to be doing anything.

    We tried implementing it to our own flixel game and although it works on a flash viewer, it doesn’t work when it is online.

    Is it because the browser is preventing the pop-up box from opening?

    Thanks!

  • September 23rd 2011 at 10:10 am

    Hi Karlo – Nope it’s a Flash sandbox permissions error. The event that triggers the screen capture has to be fired from either a MouseEvent or KeyboardEvent function, that’s why it only works locally. It shouldn’t be that hard to modify to make it work from a real event if you need.

Make yourself heard