Screen Capture

Screen capture is a little messy in mProjector 3.0 but workable. The sample below shows how to capture the entire screen and just a piece of the screen.

On the Mac there is only one way to do a screen grab -- use mApplication.captureScreenToJPG(). To capture the screen on a Mac, first set up a MovieClipLoader object with an onLoadInit callback, call mApplication.captureScreenToJPG() with a file path for the screen grab JPG, then call the MovieClipLoader's loadClip method with the JPG path and the movieclip where you will display the JPG. If you need to capture just a piece of the screen, set the scrollRect property of the movieclip.

Windows can work exactly like the Mac with the exception of needing to call a non-documented function mScreenCapture.captureScreenToJPG() on Windows instead of mApplication.captureScreenToJPG() on the Mac.

The Windows only method mScreenCapture.captureScreenToJPG() is a bit more powerful than the Mac mApplication.captureScreenToJPG() method as it has optional clipping region parameters so you have the option of not using scrollRect property of the display movie clip.

mScreenCapture.captureScreenToJPG(filepath, left, top, right, bottom);

Windows gives you another option as well. There is an old school command mApplication.captureScreen() that loads the image directly into a movie clip. This method requires you use compile-time instantiated movieclip with a onClipEvent(data) event handler to scale your loaded image - doesn't work for dynamically created movieclips.

You can download this sample, "Capture Screen", from the mProjector Samples page -- http:www.screentime.com/software/mprojector/flas.html#captureScreen.