简体   繁体   English

如何使用AS3将文本文件加载到Flash中?

[英]how to load text file into flash using AS3?

How to load text file into flash using AS3 . 如何使用AS3将文本文件加载到Flash中。 and the text file not on the root but on my server on the internet 和文本文件不在根目录上,而是在我的互联网服务器上

There are already a few posts about this. 已经有一些关于此的文章。

Here are 2 examples: Flash AS3 Read Text File and Working with txt file on as3 这里有两个示例: Flash AS3读取文本文件在as3上使用txt文件

What part, specifically, are you stuck on? 具体来说,您坚持哪一部分?

UPDATE: 更新:

var url:String = "http://concept-vs.com/load/my_text_file.txt";
var loader:URLLoader = new URLLoader(new URLRequest(url));
loader.addEventListener(Event.COMPLETE, onFileLoaded);
function onFileLoaded(e:Event):void
{
    var loader:URLLoader = e.target as URLLoader;
    var text:String = loader.data; // variable text now holds the text from the file
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM