12 Replies Latest reply on Nov 5, 2009 2:34 AM by jocoo

    line break

    Help_Laura
      Hi,

      Just a simple question really, but what is the syntax for a line break in flash. I have an array with a large amount of text and within the text i want to insert a break to make it go to the next line.

      Thanks In Advance
        • 1. Re: line break
          Level 7
          Help_Laura,

          > Just a simple question really, but what is the syntax for a
          > line break in flash.

          Depends on how you're presenting that text. If you're using HTML, a
          line break would be <br />; if you're using plain text, it would be \n.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: line break
            kglad Adobe Community Professional & MVP
            \n for new line
            \r for carriage return
            • 3. Re: line break
              Help_Laura Level 1
              quote:

              Originally posted by: kglad
              \n for new line
              \r for carriage return


              too many options, whats the difference?

              • 4. Re: line break
                Beppo5
                newline actually ends the line and starts printing on the next line down
                a carriage return doesn't actually end the line, it just starts printing on the next line down.
                That was ambiguous! Basically (and anyone can correct me if I am off, obv.) a newline is like the start of a new paragraph and a carriage return is like a soft break.

                You should probably use newline when creating new paragraphs and carriage returns when you want the information you are writing to be put on a new line.

                Hope that helps
                • 5. Re: line break
                  kglad Adobe Community Professional & MVP
                  there's no difference in what you'll see displayed by flash.

                  (there's an historic difference between the two and different applications can use one or the other or both so when testing for a new paragraph in text that's imported into flash it's a good idea to remember to check for both.)
                  • 6. Re: line break
                    Help_Laura Level 1
                    Thanks, yeah i think i get you.

                    Just on a similar note, my array contents are very long, is there a way in the code i can start a new line? what do i need to put at the end of the line to make it aware it follows on the previous line.
                    • 7. Re: line break
                      kglad Adobe Community Professional & MVP
                      for a string that you want to make more readable in the flash authoring environement you can use:

                      // hard to read:

                      s="your long string that goes much further than this...";

                      // or somewhat easier to read:

                      s="your long string";
                      s+=" that goes";
                      s+=" much further"
                      s+=" than this...";
                      • 8. Re: line break
                        kglad Adobe Community Professional & MVP
                        so, for an array containing long strings, instead of:

                        a=["long string 1...","long string 2...",...]

                        //use:

                        s1="long string 1";
                        s1+="...";
                        s2="long string 2";
                        s2+="...";
                        etc

                        a=[s1,s2,...];
                        • 9. Re: line break
                          Help_Laura Level 1
                          i get an error with this

                          **Error** Scene=Scene 1, layer=Layer 3, frame=1:Line 15: Operator '+' must be followed by an operand
                          • 10. Re: line break
                            Level 7
                            That is a thing I was about to ask.
                            In my case appeding a string using += in Flash seems to insert line beak
                            even if there no line break in the string so that the string looks broken
                            not only in the authoring tool but in Flash Player too
                            the code is:
                            -----------------------------------------------------------
                            for(var i=0;i<so_statistics.data.name.length;i++)
                            {
                            mc.mcTxt.htmlText=mc.mcTxt.htmlText+so_statistics.data.name ;
                            }
                            -----------------------------------------------------------

                            the array so_statistics.data.name[] is populated by pushing into it strings
                            entered into a text field - perhaps thise strings contain a line break?
                            . How do I append a string if I do not want these breaks?
                            The strings are sent by clicking a button, not using ENTER key

                            "kglad" <webforumsuser@macromedia.com> wrote in message
                            news:ev0d11$514$1@forums.macromedia.com...
                            > for a string that you want to make more readable in the flash authoring
                            > environement you can use:
                            >
                            > // hard to read:
                            >
                            > s="your long string that goes much further than this...";
                            >
                            > // or somewhat easier to read:
                            >
                            > s="your long string";
                            > s+=" that goes";
                            > s+=" much further"
                            > s+=" than this...";
                            >


                            • 11. Re: line break
                              kglad Adobe Community Professional & MVP
                              the code i posted is correct.

                              laura, copy and paste the code that you used that resulted in a compiler error.

                              aa, you must have carriage returns or line breaks in your so's name. use indexOf() ot check and use split("\n").join("").split("\r").join("") to remove.

                              • 12. Re: line break
                                jocoo

                                Sorry if i am wrong or doule post, but I couldnt find andy solutions of my questions.

                                Can someone tell me how i can set the <br> tag, that i dont get a new recess?

                                Is it impossible?Every time if i write <br> it looks

                                 

                                example text <br>

                                    <-- its the new empty recess.

                                heres the new line beginning.

                                 

                                 

                                Thx for help

                                Jon