capture part of screen shot into clipboard

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”;
layout=”absolute” initialize=”initNew()”
width=”320″ height=”370″>
import mx.controls.Image;

private const image_path:String = “fxr.png”;
private var loader:Loader;
private var request:URLRequest;

private var loadBD:BitmapData;
private var cropBD:BitmapData;

private var startPoint:Point;
private var posPoint:Point;
private var square: int;
private var mtrx: Matrix;

private function initNew():void
loader=new Loader();
request=new URLRequest(image_path);

private function onComplete(event:Event):void {
loadBD = Bitmap(event.currentTarget.content).bitmapData;;, 0,
loadBD.width, loadBD.height);;

//make initial image


private function drawImage():void
//crop square
startPoint = new Point(xSelector.value,    ySelector.value);
square = sizeSelector.value;

//resize image and show it

private function cropImage(startPoint:Point, squareSize:int):void
// Make a new bitmap data using square size
cropBD = new BitmapData(squareSize, squareSize, true, 0x00000000);
// Position where will be dispayed in the new object, in our case (0,0)
posPoint = new Point(0,0);
// copy pixels from loaded bitmap data to our new object
new Rectangle(startPoint.x, startPoint.y, squareSize, squareSize),

//draw crop area selected;, 0xFFFFFF,0.5);, 0, cropBD.width, cropBD.height);


private function resizeImage():void
// make scale matrix
mtrx = new Matrix();

// Fill in image;,mtrx,false);, 0, imageView.width, imageView.height);;


<mx:Canvas id=”imageView”   x=”210″ y=”10″ width=”100″ height=”100″ />
<mx:Canvas id=”imageHolder” x=”10″ y=”120″ width=”300″ height=”240″ />
<mx:Canvas id=”imageCrop”   x=”0″ y=”0″ width=”0″ height=”0″ />

<mx:Label x=”10″ y=”15″ width=”60″ text=”X position”/>
<mx:HSlider id=”xSelector” x=”80″ y=”10″ width=”120″
minimum=”0″ maximum=”290″ snapInterval=”10″ enabled=”true”
value=”170″ change=”drawImage()” />

<mx:Label x=”10″ y=”55″ width=”60″ text=”Y position”/>
<mx:HSlider id=”ySelector” x=”80″ y=”50″ width=”120″
minimum=”0″ maximum=”230″ snapInterval=”10″ enabled=”true”
value=”20″ change=”drawImage()” />

<mx:Label x=”10″ y=”95″ width=”60″ text=”Area size”/>
<mx:HSlider id=”sizeSelector” x=”80″ y=”90″ width=”120″
minimum=”10″ maximum=”240″ snapInterval=”10″ enabled=”true”
value=”100″ change=”drawImage()” />


~ by mjcprasad2000 on January 22, 2009.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: