Thoughts on shu & screen capture with AIR

I was checking out shu, a niche packager of AIR applications to extend the functionality and improve the installation experience (maybe), and caught myself before going off on a rant. The short story of that is shu may be a great solution for your particular needs, especially if those needs include calling external applications, accessing MySql, though not through ODBC, using custom DLLs for your app, and other fun things.

One of those other fun things that got me thinking was the ability to do screen captures. In a late Friday moment of being simple, I thought, "how hard is that"? So, in five minutes I wrote an AIR application that does screen capture with no extras needed.

Several minutes after that, I realized that I cheated. Damn damn damn.

My Screen Capture Cheat

What I created so quickly was just a Clipboard grabber, a cut-n-paste trick. For Windows users, not so sure how it is for you Mac Hippies or Suspendered Linux Folk, just do a <control>-PrtScrn and the hard part of screen capture is done for you. Now all you need to do is to create a Bitmap out of the BitmapData that found its way into your clipboard and you can do whatever you need to with it. It's fun and easy and you can try it yourself:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="" layout="absolute" applicationComplete="init()">

import mx.core.BitmapAsset;
import mx.utils.ObjectUtil;
import mx.controls.Alert;    
private var systemClipboard:Clipboard;    
private function init():void {
systemClipboard = Clipboard.generalClipboard;
private function test():void {        
var bm:Bitmap = new Bitmap(BitmapData(systemClipboard.getData(ClipboardFormats.BITMAP_FORMAT)));
imgTarget.source = bm;        

    <mx:Button label="test" click="test()" />    
    <mx:Image top="0" right="0" bottom="0" left="0" id="imgTarget"/>

The cheat, of course, is that the user has to go out of his or her way to put the image onto the clipboard; it takes a coordinated effort. What took me awhile to realize about shu is that you can call the shu.Screen.capture(yada yada) whenever you damn well feel like it. At a time when others are attacking AIR for being too insecure it is ironic that shu actually makes the platform even more open for evil-doers ... think spyware ... literally.

Mind you, I'm ok with that. One ought not to be promiscuous in installing applications and I don't think one can blame the platform for the bad decisions that users make. The same potential to harm that others see is also the ability to help. I would just rather people were taught to be apprehensive about all of their software choices so as not ever put blind faith into any app or platform as they are all eventually corruptible.

So, short story long, shu doesn't do anything for me right now, but its extra features might be tremendous for your project needs.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Mariush T.'s Gravatar Hi, I have used swf2exe(Zinc, SWF Studio etc) tools before, but i've never heard of Shu. I think Shu Player is worth checking out. Thanks for tutorial
# Posted By Mariush T. | 6/27/09 1:09 AM
BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner