티스토리 뷰
<?xml version="1.0" encoding="utf-8"?>
< mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.graphics.codec.JPEGEncoder;
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, onOutputProgressEvent);
fs.openAsync(file, FileMode.WRITE);
fs.writeBytes(ba);
}
private function onOutputProgressEvent(e:OutputProgressEvent):void{
trace("완료!!");
e.currentTarget.close();
}
]]>
</mx:Script>
<mx:Button x="710" y="516" label="캡쳐" click="this.capture()"/>
<mx:DataGrid x="100" y="107">
<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>
< /mx:WindowedApplication>
'Language > Flex' 카테고리의 다른 글
[ Flex AIR ] RemoteObject / method (0) | 2015.11.29 |
---|---|
[ Flex AIR ] WindowedApplication (0) | 2015.11.29 |
[ Flex AIR ] app.xml 초기 설정 (0) | 2015.11.29 |
Flex - PDF : 아크로벳 리더 프로그램이 있어야지만 실행됨 (0) | 2015.11.29 |
[ Flex ][ CSS ] (0) | 2015.11.29 |