Adding line breaks in AS3

I'm trying to add line breaks after the code that I've included below. I know that I need to add a '\n' after the line of text, but I did have a success.


textField.appendText ("" + bldg.) S11 [i]. Title.Text ())
textField.appendText ("Square Footage:" + bldg.) S11 [i]. SF.text ())
textField.appendText ("tenant:" + bldg.) S11 [i]. Tenant.Text ())
textField.appendText ("Status:" + bldg.) S11 [i]. Status.Text ())

Thank you.

You must have a TextField called 'textField' and he needs to "wordWrap" and "multiline" property set to true (as in kglad post - but there is no "html" for the AS3 TextField class property).

Then you can either use the html text or normal text:

           // html text
            var myText:String = new String();

            for(var i:uint = 0; i < bldg.S11.length(); i++){
                myText += bldg.S11[i].Title + "
"; myText += "Square Footage: " + bldg.S11[i].SF + "
"; myText += "Tenant: " + bldg.S11[i].Tenant + "
"; myText += "Status: " + bldg.S11[i].Status + "
"; } textField.htmlText = myText;
           // normal text
           var myText:String = new String();

           for(var i:uint = 0; i < bldg.S11.length(); i++){
                myText += bldg.S11[i].Title + "\n";
                myText += "Square Footage: " + bldg.S11[i].SF + "\n";
                myText += "Tenant: " + bldg.S11[i].Tenant + "\n";
                myText += "Status: " + bldg.S11[i].Status + "\n";
            }

            textField.text = myText;

Tags: Adobe Animate

Similar Questions

  • Adding line breaks in an as3 string variable?

    Hey guys

    I have two globals vars...

    Globals.Data.var1 = "test1";

    Globals.Data.var2 = "test2."

    I then add to...

    Globals.Data.Everything = globals.data.var1 + globals.data.var1;

    which, once traced...

    trace (Globals.Data.Everything);

    outputs...

    test1test2

    I want to exit

    Test1

    test2

    How do I do that? What I put in the code: globals.data.everything = globals.data.var1 + globals.data.var1;

    I figured out how to add a space:

    Globals.Data.Everything = globals.data.var1 + "" + globals.data.var1;

    outputs...

    Test1 test2

    But I can't understand how to add a line break.

    Thanks for your help on this one.

    Shaun

    You are welcome.

    Please mark this thread as answered, if you can.

  • Closed captioning line break

    Is it possible to add newlines to captioning in Captivate? I was copy and paste my text from Word and adding line breaks there. But sometimes you just need a straight jump track and do not want to use the word.

    Yes.  Open the properties of the slide to the slide containing the CC that you want to change, and then click the Audio tab.  Now, click on the button captions and a new dialog box will open containing your text CC.  This is where you can control the timing of your subtitles as well.

    I hope this helps!

    Randy

  • AS3 \n = line break, what would you say tab spacing?

    Hi all

    In AS3, we can format textfield to a line break using \n. And now I'm trying to find out how to use spacing of tab in AS3?

    I want to format my textfield to look like this:

    Name: Jane

    Age                  : 18

    Sex: F

    Currently, it looks like this (very ugly):

    Name: Jane

    Age: 18

    Sex: F

    Thank you

    -Zainuu

    Here is a list of additional escape characters including tab:

    http://livedocs.Adobe.com/Flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts & file = 00000948.html

  • Adding a line break in a commandButton control

    Hi all

    I have a command button long as 'Test button text with characters long '. His long I want to add line break in the text of this button to make it look like:

    'Test button '.

    text with

    characters long.

    Please let me know how to get there (I tried the setting with the width and height of the button, but the text does not change)

    Thanks in advance,

    ASHA

    You can create skin and play with css, see for example if my answers from here can help you: https://community.oracle.com/thread/3607134

    Dario

  • Adding breaks of the hyper link with line break

    I am trying to add a hyperlink to my document. The text I'm tying is long and crosses a line break. I select the text and then add the hyperlink, which seems to work very well, but then when I export to PDF and then click on the link, the link is broken at the break.

    Does anyone knows how to fix this?

    Yes. It is not InDesign, that determines what the hyperlink is right there, but rather the 'smart' function Acrobat who sees an address "www" and reads the text to the right on the PDF file. Pass this function disabled in Acrobat , and it should work.

    You can confirm that you have actually exported your document with active hyperlinks (it's a toggle in the export to PDF dialog box).

  • The line breaks in the window AS create lag? (AS3)

    Hi guys

    I am optimize my AS3 project and I was wondering if empty lines in the AS3 code create a lag in time?  I have a lot of components and I was wondering if stripping empty lines in the code to make a difference?

    See you soon

    Shaun

    You mean during compilation? Certainly not during execution of code in bytes.

  • A string literal must be completed prior to the line break

    I just started learning flash so I suffer some of the most difficult problems that beginners have. I copied code from a tutorial only I seem to have problems with strings when I use line breaks. Even by putting:

    var quoteContent:String = "the question of if.
    This ";

    generates this error:
    'A string literal must end before the line break.
    or
    «Syntax error: expected semicolon before plusassign.»

    everything that's want to say...

    Does that mean that in CS4 that line breaks in strings are not allowed? I also tried the concatenation channel lines together using the += but who was not working and was tedious. In addition, adding \n at the end or at the beginning of lines doesn't seem to work. Why is this a big deal for flash?

    Only a string without newlines works.

    Quote:
    Posted by: Andrei1
    As the indicated error AS3 does not allow line breaks in the assignment of the string and the string should end with a quote on the same line, he started. In other words, the string can be on a single line only.

    Thanks Andrei1. For Actionscript 3 can't make multiline in all chains. Looking at this new I can see why it happened. The original string had several lines in there but no line breaks. I then turned off Word wrapping to diagnose the problem. My own line breaks were what caused the problem.

    I realize that it could not be a simpler problem to work but it took a while to diagnose because of the useless error message.

    Solution: Put all your channels on 1 line and turn the enveloping Word by going to the drop down in the upper right panel actions and clicking (ctrl + shift + w) line.
    Line numbers will allow you to see if you have line breaks where you shouldn't.

  • drop-down list - option line break

    Is it possible to add a line break to a drop down list?

    Or change the width of the drop-down list when the user clicks to view the options?

    Some of the text I have is very long and you can't read it all.

    With the help of this question, I could get this job.

    https://forums.Adobe.com/message/2208564#2208564

    Displaying the XML Source Code and adding
    to produce a carriage return.

  • Widow and line break TextField

    Hello

    In a TextField with multiline set to true, how can I find where the text has a line break?

    I want to find the breaking point and then find a "widow", I want to find out how many words after the line break. I heard that the text field creates a software interrupt.

    I believe that this is the position of the soft line break-

    textField.text.indexOf('\r')


    Then I have to get the string after that position.


    Then get an array of the words in this chain, something like this-

    String.Split(/\w | ' | (/ IG);


    Can anyone share any advice or solutions?


    DJ Gecko says:

    Hi Kglad,

    Thanks again for the help. I had to make some changes so that it can work properly.

    public static void countWords(tf:TextField,_s:String):Vector.

    {

    var returnA:Vector. = new Vector. ();

    var textA:Array = s.split(' ');

    var save: String = tf.text;

    TF. Text = ";

    var num_line:uint = 1;

    var wordCnt:uint = 0;

    for (var i: uint = 0; i< texta.length;="">

    {

    tf.appendText (textA [i] + "");

    wordCnt ++;

    If (tf.numLines! = num_line)

    {

    the last word added to the created text field a new line

    We do not want to include this last word to our word count for the previous line

    -wordCnt;

    returnA.push (wordCnt);

    num_line = tf.numLines;

    Since the last added word created the new line, we add it to our account

    wordCnt = 1;

    }

    }

    If there is a single line, we need. If there is more than one line, then this is the number of words to the last line

    returnA.push (wordCnt);

    TF. Text = saves;

    return returnA;

    }

    glad to hear that you guessed it work.

  • Is it possible to change the format of the email, the Muse form Widget product? For example by adding lines between fields?

    Is it possible to change the format of the email, the Muse form Widget product? For example by adding lines between fields? I have a 15 part form and email it sends can become hard to read you get to half way down, since there is no line break between the form field.

    Hello

    Currently, Adobe Muse does not allow to edit this format of electronic mail. have you tried using any form of third party like jotform, they could be useful.

  • line break conditional regions

    Hello!

    Is it possible to use conditional regions without adding a line break if the condition is met?

    What I use is a simple:

    <? If: STATUS = "IN_PLAN?" > Some Text <? end if? > Some Other Text

    and he always breaks the line after 'Some Text'...

    BR Paul

    Can you send me the xml file and the model RTF to [email protected]? I can take a look.

    Thank you
    Bipuser

  • Problem with XML and different line break styles

    I'm working on a project that is being developed by some developers Flash Builder 4.6 running in Windows and some developers Flash Builder 4.6 running under OSX. We have difficulties due to the difference of newlines between the two environments. In an .as file with line breaks in style UNIX is similar to the following code:

    var XML = < document >

    < item >

    < / item >

    < / document >;

    xml.appendChild (SomeClass.getXML ());

    SomeClass.getXML () is located in a file .as using type line breaks Windows and is similar to the following:

    public function getXML (): XML

    {

    var moreXML:XML = < anotherElement >

    < childElement >

    < / childElement >

    < / anotherElement >;

    Return moreXML;

    }

    When the XML object is serialized and written to a file on a Windows computer, it looks like this:

    < document >

    < item >

    < / item >

    < anotherElement >

    < childElement >

    < / childElement >

    < / anotherElement > < / document >

    Line for all outside anotherElement breaks are of the form \r\n. Line breaks it contains are of the form \r\r\n, causing thus the empty lines. I'm guessing that the odd line breaks are the cause of the strange setting indented, as well. None of these problems occur when XML is added to the xml file .as that employees style UNIX line breaks.

    Is it possible to force the Flash Builder to use UNIX on Windows style line breaks? Otherwise, there are relatively specific to this problem solutions? Thank you!

    Section clarified

    I found a setting to force a certain style of line breaks: window-> Preferences-> General-> Workspace (delimiter line of file new text). The XML serializes as planned today.

  • In v31.0, I can view is more 'raw' XML files with line breaks and ' &lt; ' and ' / &gt; ' characters. Is there a setting that will give me this option?

    Until a few days ago when I opened a file XML with Firefox, I see the content of the file appears with line breaks and ' < ' and ' / > ' and elements. Like this:

    fixed image in < typeOfResource > < / typeOfResource >

     <genre authority="marcgt">picture</genre>
     <genre authority="nmc">Print, Photographic</genre>
     <originInfo>
       <dateIssued encoding="marc">1884</dateIssued>
       <dateIssued encoding="marc">1884</dateIssued>
       <issuance>monographic</issuance>
     </originInfo>
     <language>
    

    Now, it will display like this:

     still image picture Print, Photographic 1884 1884 monographic eng electronic
    

    No tags or line breaks. I need to see the entire XML file. How can I configure FireFox to display this for me? One of my colleagues uses v31.0 and XML views with tags and the line breaks for him.

    For example, I was looking at files sitemap.xml (search Google for inurl:sitemap.xml). For those who have not declared a style sheet, you should always see the classic "source highlight: presentation

    Example: http://www.website.com/sitemap.xml

    Are the files that don't appear as similar planned by not declaring a style sheet?

    As a temporary workaround, you can view the source to see the original. Either:

    • CTRL + u
    • Right click > view Page Source
  • Easy way to remove excess line breaks in txt, html, and epub files?

    Transfer to my e-reader to read web pages. I have to convert everything in epub, because the PDF files and djvus are designed for larger screens, and txt and html are not displayed correctly.

    In any case, some pages have a lot of extra newlines that are arranged for larger screens.

    I have to remove the line breaks to make it readable. I know that DevonTech wordservice works in txt, which I can convert it to Epub. Is there something that works in Epub itself? Is there something else that works in txt?

    Thank you.

    INTHE html, these line breaks appear to be either < br / > or < br / > where the paragraph breaks are < p >. So, it seems easier to edit files ePub in the editor, as the iWrite series Epub or the caliber, that the modification of the txts.

Maybe you are looking for