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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

博客园 - 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>

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