存取flex屏幕快照
所属分类:
网页制作 / Flash
阅读数:
1659
收藏 0赞 0分享
<?xml version="1.0" encoding="utf-8"?>
<!-- http://yecon.blog.hexun.com/31031093_d.html -->
<Application name="FileReference_save_test"
xmlns="http://ns.adobe.com/mxml/2009"
xmlns:mx="library:adobe/flex/halo"
xmlns:net="flash.net.*"
layout="flex.layout.BasicLayout"
creationComplete="init();">
<Script>
<![CDATA[
private function init():void {
textArea.text = describeType(FileReference).toXMLString();
}
private function btn_click(evt:MouseEvent):void {
fileReference.save(textArea.text, "describeType.txt");
}
]]>
</Script>
<Declarations>
<net:FileReference id="fileReference" />
</Declarations>
<mx:Panel id="panel"
width="500"
height="300"
verticalCenter="0"
horizontalCenter="0">
<mx:TextArea id="textArea"
editable="true"
width="100%"
height="100%" />
<mx:ControlBar horizontalAlign="right">
<Button id="btn"
label="Save Text"
click="btn_click(event);" />
</mx:ControlBar>
</mx:Panel>
</Application>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//也可以通过XML对象直接使用FileReference类的save()方法:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://yecon.blog.hexun.com/31031093_d.html -->
<Application name="FileReference_save_test"
xmlns="http://ns.adobe.com/mxml/2009"
xmlns:mx="library:adobe/flex/halo"
xmlns:net="flash.net.*"
layout="flex.layout.BasicLayout"
creationComplete="init();">
<Script>
<![CDATA[
private const xmlObj:XML = describeType(FileReference);
private function init():void {
textArea.text = xmlObj.toXMLString();
}
private function btn_click(evt:MouseEvent):void {
fileReference.save(xmlObj, "describeType.xml");
}
]]>
</Script>
<Declarations>
<net:FileReference id="fileReference" />
</Declarations>
<mx:Panel id="panel"
width="500"
height="300"
verticalCenter="0"
horizontalCenter="0">
<mx:TextArea id="textArea"
editable="true"
width="100%"
height="100%" />
<mx:ControlBar horizontalAlign="right">
<Button id="btn"
label="Save"
click="btn_click(event);" />
</mx:ControlBar>
</mx:Panel>
</Application>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//可以使用ImageSnapshot类来抓取截图,并通过将ByteArray交给FileReference类的save()方法对象保存到本地硬盘:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://yecon.blog.hexun.com/31031093_d.html -->
<Application name="FileReference_save_test"
xmlns="http://ns.adobe.com/mxml/2009"
xmlns:mx="library:adobe/flex/halo"
xmlns:net="flash.net.*"
layout="flex.layout.BasicLayout"
creationComplete="init();">
<Script>
<![CDATA[
import mx.graphics.ImageSnapshot;
import mx.graphics.codec.*;
private const jpegEnc:JPEGEncoder = new JPEGEncoder();
private const xmlObj:XML = describeType(FileReference);
private function init():void {
textArea.text = xmlObj.toXMLString();
}
private function btn_click(evt:MouseEvent):void {
var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(panel, 0, jpegEnc);
fileReference.save(imageSnap.data, "describeType.jpg");
}
]]>
</Script>
<Declarations>
<net:FileReference id="fileReference" />
</Declarations>
<mx:Panel id="panel"
width="500"
height="300"
verticalCenter="0"
horizontalCenter="0">
<mx:TextArea id="textArea"
editable="true"
width="100%"
height="100%" />
<mx:ControlBar horizontalAlign="right">
<Button id="btn"
label="Save"
click="btn_click(event);" />
</mx:ControlBar>
</mx:Panel>
</Application>
火山动态文本滚动条V5[AS3版]
功能说明:本版滚动条除了继续保持体积小(小于2K),界面容易修改,资源占用率小的优势外,主要有以下几点改进:
1,使用AS3编写。
2,宽高动态指定。
3,增加滚动条背景点击事件。
4,消除了鼠标滚轮无法同时准确控制多个文本框的重大BUG。
收藏 0赞 0分享
关于类、私有属性与继承的理解
学习FLASH的时间也不短了,但总觉得还有很多的东西在等我去弄清楚。而且有很多东西也是搞得似懂非懂。在这里,把类、私有属性跟继承的理解讲一下。也希望大家能无私补充,以臻佳景。
收藏 0赞 0分享
FLASH自动判断域名然后转向等操作
FLASH自动判断域名,如果不是你的域名,然后干什么你来定吧!
首先说一下FLASH自已可以干什么!FLASH他可以判断自已在哪个路径下面,例如:
收藏 0赞 0分享
Flex程序开发心得小结
和Flash的开发环境相比,Flex提供的组件库确实很诱人,但由于功能太全面,导致程序的体积大,有时候使用不当,可能会影响程序运行效率。
收藏 0赞 0分享
关于FLASH与XML交互应用中的理解
关于XML在FLASH中的应用,以前写过几篇。也收集了几篇来自网络的。不过,都是一些非常简单而常用的。在这里,我把XML的其他相关说明总结一下。有不足之处,希望大家能相互补充。只为了一个共同的目的:共同提高。
收藏 0赞 0分享
查看更多