1 Reply Latest reply on Apr 26, 2006 1:48 PM by Newsgroup_User

    Differences with LoadVars in Flash 8?

    vanboke
      I am trying to load text from a text file using LoadVars. The text has HTML tags in it for formating, and I am assigning a CSS to it as well to ease some of the formating. Pretty standard. If I publish my flash project as Flash 8, LoadVars seems to pick up the carriage returns in the text file, and add those carriage returns to the HTML formating. The result is the loaded text with a lot of extra whitespace in it. If I then publish the same project as Flash 7, it works as I would expect and doesn't pick up the carriage returns in the text file.

      What has changed in Flash 8 to cause this? Anyone know? Is there an easy way around this problem besides stripping out all the carriage returns in the text file? I would hate to do that since it makes maintaining the text files much more cumbersome.

      Here is the code I am using for those that want to know:

      var loadText:LoadVars = new LoadVars();
      loadText.load("content.txt");

      loadText.onLoad = function(success) {
      if (success) {
      content_txt.htmlText = this.contentText;
      }
      }

      var contentStyle = new TextField.StyleSheet();
      contentStyle.load("content.css");
      content_txt.styleSheet = contentStyle;

      Any help or guidance would be appreciated.
      Thank you.
      Eric
        • 1. Re: Differences with LoadVars in Flash 8?
          Level 7
          Generally I would not put unwanted characters into a LoadVars text file as
          it should by industry standards be expecting a nice data stream that Flash
          parses using the & and = into your data.

          --
          Lon Hosford
          www.lonhosford.com
          May many happy bits flow your way!
          "vanboke" <webforumsuser@macromedia.com> wrote in message
          news:e2k97p$hn6$1@forums.macromedia.com...
          I am trying to load text from a text file using LoadVars. The text has HTML
          tags in it for formating, and I am assigning a CSS to it as well to ease
          some
          of the formating. Pretty standard. If I publish my flash project as Flash 8,
          LoadVars seems to pick up the carriage returns in the text file, and add
          those
          carriage returns to the HTML formating. The result is the loaded text with a
          lot of extra whitespace in it. If I then publish the same project as Flash
          7,
          it works as I would expect and doesn't pick up the carriage returns in the
          text
          file.

          What has changed in Flash 8 to cause this? Anyone know? Is there an easy
          way
          around this problem besides stripping out all the carriage returns in the
          text
          file? I would hate to do that since it makes maintaining the text files much
          more cumbersome.

          Here is the code I am using for those that want to know:

          var loadText:LoadVars = new LoadVars();
          loadText.load("content.txt");

          loadText.onLoad = function(success) {
          if (success) {
          content_txt.htmlText = this.contentText;
          }
          }

          var contentStyle = new TextField.StyleSheet();
          contentStyle.load("content.css");
          content_txt.styleSheet = contentStyle;

          Any help or guidance would be appreciated.
          Thank you.
          Eric