home *** CD-ROM | disk | FTP | other *** search
/ NCSoft Asset Disc (USA) / NCSoft Asset Disc (USA).bin / coh.swf / scripts / %3Cdefault package%3E / TextLoader_Symbol.as < prev   
Encoding:
Text File  |  2003-05-03  |  1.1 KB  |  41 lines

  1. TextLoader = function()
  2. {
  3.    this.init();
  4. };
  5. TextLoader.prototype = new MovieClip();
  6. TextLoader.prototype.convertToHTML = function(textData)
  7. {
  8.    textArr = textData.split("\n");
  9.    textData = textArr.join("");
  10.    return textData;
  11. };
  12. TextLoader.prototype.loadData = function()
  13. {
  14.    this.dataXML = new XML();
  15.    this.dataXML.ignoreWhite = true;
  16.    this.dataXML.thisPath = this;
  17.    this.dataXML.onLoad = function(success)
  18.    {
  19.       if(success)
  20.       {
  21.          this.thisPath._parent[this.thisPath.targetTextField].html = true;
  22.          this.thisPath._parent[this.thisPath.targetTextField].htmlText = this.thisPath.convertToHTML(this.firstChild.firstChild.nodeValue);
  23.          this.thisPath._parent.play();
  24.       }
  25.       else
  26.       {
  27.          getUrl("JavaScript: window.alert(\'Sorry, Failed to Load XML Data\')", "");
  28.       }
  29.    };
  30.    this.dataXML.load(this.xmlFile);
  31. };
  32. TextLoader.prototype.init = function()
  33. {
  34.    System.useCodePage = true;
  35.    this.targetTextField = "overviewTF";
  36.    this.xmlFile = _level0.currentPath + this.filePath;
  37.    this._parent.stop();
  38.    this.loadData();
  39. };
  40. Object.registerClass("TextLoader_Symbol",TextLoader);
  41.