惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
O
OpenAI News
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
S
Schneier on Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
L
LINUX DO - 热门话题
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
Security Latest
Security Latest
S
SegmentFault 最新的问题
Project Zero
Project Zero
Spread Privacy
Spread Privacy
K
Kaspersky official blog
J
Java Code Geeks
V
Vulnerabilities – Threatpost
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
月光博客
月光博客
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
WordPress大学
WordPress大学
量子位
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
S
Secure Thoughts
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
Visual Studio Blog
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
腾讯CDC
Cyberwarzone
Cyberwarzone
IT之家
IT之家
GbyAI
GbyAI
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
云风的 BLOG
云风的 BLOG
T
Troy Hunt's Blog
D
Docker

博客园 - Ray Lynn

Google Chrome 源码下载 什么是SAAS? QQ盗号木马原理 WindowsSockets 错误码 js操作cookies类 使用 Microsoft SOAP Toolkit 2.0 建立安全 Web 服务 历史上最强的代码 饭否,唧歪们MSN、QQ、GTalk机器人实现原理及代码 这是比月读还强的幻术!! - Ray Lynn - 博客园 .net 中的伪静态方式. 来自 Discuz!NT 伪静态网页的实现 ACCESS 创建表及索引方式 VB6 判断网络是否正常类 眼保健操 面向服务的面向业务基础 VB6编程中如何获取硬盘分区信息 原味香菇片蒸鸡腿 定制特性学习笔记 [转]C#中的定制特性(Attributes)
使用 flex air 读写文件 - Ray Lynn
Ray Lynn · 2008-11-23 · via 博客园 - Ray Lynn

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" width="429" height="376">
<mx:Script>
<![CDATA[
import mx.messaging.AbstractConsumer;

private function init():void{

}

private function onOpen():void
{
var file:File = new File();
file.browseForOpen("Select a text file",[new FileFilter("text file","*.txt")]);
file.addEventListener(Event.SELECT,onFileSelect);
}

private function onFileSelect(e:Event):void{
var fs:FileStream = new FileStream();
txtPath.text = File(e.target).nativePath;
fs.open(File(e.target),FileMode.READ);
txtContent.text = fs.readUTFBytes(fs.bytesAvailable);
fs.close();
}

private function Save():void{
var fs:FileStream = new FileStream();
fs.open(new File(txtPath.text),FileMode.WRITE);
fs.writeUTFBytes(txtContent.text);
fs.close();
}
]]>
</mx:Script>
<mx:TextInput id="txtPath" x="10" y="10" width="321"/>
<mx:Button id="btnOpen" x="339" y="10" label="Open" click="onOpen()"/>
<mx:TextArea id="txtContent" x="10" y="40" width="394" height="276"/>
<mx:Button x="339" y="324" label="Save" click="Save()"/>
</mx:WindowedApplication>

虽然读写过程都正常,但遇到中文字符时就会出现乱码,不知何因.