private function capture() : void
{
var bd:BitmapData = new BitmapData(this.width,this.height);
bd.draw(this);
var encoder:JPEGEncoder = new JPEGEncoder(60);
var ba:ByteArray = encoder.encode(bd);
var file:File = File.desktopDirectory.resolvePath("Test2.jpg");
var fs:FileStream = new FileStream();
fs.addEventListener(OutputProgressEvent.OUTPUT_PROGRESS,onOut);
fs.openAsync(file, FileMode.WRITE);
fs.writeBytes(ba);
}
private function onOut(e:OutputProgressEvent):void
{
trace("ok");
e.currentTarget.close();
}
]]]
[/mx:Script]
[mx:Button x="284" y="194" label="Button" click="this.capture();"/]
[mx:DataGrid x="10" y="10"]
[mx:columns]
[mx:DataGridColumn headerText="Column 1" dataField="col1"/]
[mx:DataGridColumn headerText="Column 2" dataField="col2"/]
[mx:DataGridColumn headerText="Column 3" dataField="col3"/]
[/mx:columns]
[/mx:DataGrid]
Tuesday, 29 September 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment