用AS3读取不同的文件类型
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用AS3读取不同的文件类型相关的知识,希望对你有一定的参考价值。
Found this code. It is an example of loading and reading different file types with ActionScript 3
import flash.filesystem.FileMode; import flash.filesystem.FileStream; import flash.filesystem.File; var myFile:File = File.appResourceDirectory; // Create out file object and tell our File Object where to look for the file myFile = myFile.resolve("mySampleFile.txt"); // Point it to an actual file var fileStream:FileStream = new FileStream(); // Create our file stream fileStream.open(myFile, FileMode.READ); var fileContents:String = fileStream.readUTFBytes(fileStream.bytesAvailable); // Read the contens of the fileContents_txt.text = fileContents; // Display the contents. I've created a TextArea on the stage for display fileStream.close(); // Clean up and close the file stream
以上是关于用AS3读取不同的文件类型的主要内容,如果未能解决你的问题,请参考以下文章