【问题标题】:external text file not loading in actionscript外部文本文件未在动作脚本中加载
【发布时间】:2014-03-20 03:14:07
【问题描述】:

我有一个从外部文件加载文本的 flash 文件,当我在我的 windows 8 机器上本地打开它时,这个工作完美,但是当我将 flash 文件和外部文本文件上传到服务器并通过浏览器访问它时,文本不会加载到 Flash 文件中。请帮忙。这是我的代码:

Stage.align = "TC";

Stage.scaleMode = "noScale";

url = "tfile";

loadVariablesNum(url+"_main.html", 0);

function check_loaded() {

    if (_root.file_option) {
            clearInterval(intervalID);
    }
}
intervalID = setInterval(check_loaded, 100);

_root.emp.useHandCursor = 0;
///forplayer
_root.mus = 1;
_root.n = 1;
_root.num = 1;
stop();

【问题讨论】:

    标签: flash actionscript


    【解决方案1】:

    我不太确定您想对外部文本文件做什么,但我通常使用 URLRequestURLLoader 来完成。

    例如:

        var textRequest:URLRequest = new URLRequest("myfile.txt");
        var textloader:URLLoader = new URLLoader();
    
        textloader.addEventListener(Event.COMPLETE, loadText);//event to load text
        textloader.load(textRequest);//load text
    
        function loadText(event:Event):void{
        chloroText.text = textloader.data;//set the text file content as the textbox's text
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-12
      • 1970-01-01
      • 2013-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-08
      • 1970-01-01
      相关资源
      最近更新 更多