5 Replies Latest reply on Jan 3, 2009 6:50 PM by kglad

    Dynamic Text Feild with Dynamic Scroll Bar

    W_Bell Level 1
      I have a Dynamic Text Feild with a dynamic Scroll bar.
      It loads a simple ASCI text file with some html formating.
      but I still can not manage to get the text to format.

      The biggest problem with the format is a big space between paragraphs.
      I am not sure why but I think the Frame must need a var to render to html.
      Can anybody help please?
        • 1. Re: Dynamic Text Feild with Dynamic Scroll Bar
          kglad Adobe Community Professional & MVP
          in text editors you usually have a new line and carriage return (or vice versa) to indicate a new paragraph in the text file. in flash that will add one more blank line than you probably want.

          use the following to remove the problem:

          yourstring.split("\n\r").join("\r").split("\r\n").join("\r");
          • 2. Re: Dynamic Text Feild with Dynamic Scroll Bar
            W_Bell Level 1
            Thank you for the tip. I think it was white space causing the problems as I spent some time trying to apply your fix and could not make it work. I am not sure how you place the syntax. Does it go in the text file or with the script?
            I would be interested to know how if you can provide a brief example that would be great!
            Cheers.

            W Bell.
            • 3. Re: Dynamic Text Feild with Dynamic Scroll Bar
              kglad Adobe Community Professional & MVP
              that's actionscript:

              • 4. Re: Dynamic Text Feild with Dynamic Scroll Bar
                W_Bell Level 1
                My text had the following, similar but no parsing string.
                I guess yourstring.split("\n\r").join("\r").split("\r\n").join("\r");
                takes out the carrage returns or <br>?
                I notice the one I had just say's String.
                I assume that would be the text that is the string?

                Thank you for sharing your knowledge of this.


                var my_lv:LoadVars = new LoadVars();
                my_lv.onData = function(src:String) {
                if (src != undefined) {
                myTxtFeild.text = src;
                } else {
                myTxtFile.text = "Error loading text.";
                }
                };
                my_lv.load("CadnetPage1_html.txt");
                • 5. Re: Dynamic Text Feild with Dynamic Scroll Bar
                  kglad Adobe Community Professional & MVP
                  i don't understand what you're asking. but if your textfield is displaying extra space between paragraphs use:

                  var my_lv:LoadVars = new LoadVars();
                  my_lv.onData = function(src:String) {
                  if (src != undefined) {
                  myTxtFeild.text = src.split("\n\r").join("\r").split("\r\n").join("\r");

                  } else {
                  myTxtFile.text = "Error loading text.";
                  }
                  };
                  my_lv.load("CadnetPage1_html.txt");