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.

Tags: Adobe Animate

Similar Questions

  • 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;
    
  • How to put a line break between the two strings?

    I'm putting a couple of line between strMessage2 and strMessage3 breaks in the automatic email button in the following document.  What Miss me?  Thank you!

    https://Acrobat.com/#d=hSatmYfM4gqdX1cb-XRVMg

    Win 7, LC 9.0 ES2

    Make sure that you use \n and not/n.

  • Line break in the replacement string

    Is there an easy way to replace all the cart in a string?

    Like I said, one call will do. The service has a Boolean entry called "replace all? (F)"......

    Norbert

  • 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

  • delete the last character of line break

    How can I remove the newline character from the end of a string? (Note: there are several line break characters in the string). Thank you!

    This may or may not work, but it is worth it.

    If (right (Votrechaine, 1) is 10)
    Votrechaine = left (Votrechaine, 1, len (yourstring)-1);

  • 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.

  • Result of the method of the component string has line break

    I really have a strange problem when she returns a string as a result of the method of one component and trying to release this. I always get an extra line break. Stripping does not help. Here are the minimum code to reproduce this behavior:

    -Component Definintion:
    < cfproperty name = "strtest" >
    < name cffunction = 'test' returntype = "String" >
    < cfreturn 'being' >
    < / cffunction >
    < / cfproperty >

    -CFM
    < cfset com = CreateObject ("component", "strtest") >
    < cfoutput >
    This should #com.test () # only one line
    < / cfoutput >

    When I execute the script via my browser (IE or FF), and I look at the source code so there is still a line break should not.

    This only happens when you call a method of a component... call for a simple function or even temporarily store the result in a variable does not bring to this behavior.

    I recommend you read through the other posts on these forums before posting
    your own questions, in the case where your problem is land.

    I answered someone other that having exactly the same question yesterday: you
    Add output = "false" in your statement of .

    --
    Adam

  • 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

  • Help with string.split() for line breaks and spaces

    What I'm trying to do is to take a series of numbers and convert it to a table, while cutting the numbers, aren't. Here's the format:

    1.0000000E + 000 + 000 1.3668423e

    1.0000000E + 000 + 000 1.3668423e

    1.0000000E + 000 + 000 1.3668423e

    ...

    So it is basically: space, space, digits, space, space, numbers, line break

    Right now I am using the following code (myString is a string, and dataSet1 is an array):

    var reg: RegExp = new RegExp ("\n");

    myString = textLoader.data;
    myString.split (reg) = dataSet1;

    I tried ("\n\s") and ("(\n)(\s*)") and many other combinations, but I can't seem to figure out how to make multiple conditions in a regular expression. All I need to do is to remove all the spaces and line breaks and I should be good.

    I appreciate any help, thanks.

    You can use the Array.map method to convert your strings. Something like this:

    function str2Num(element:*,_index:int,_arr:Array):Number
    {
    Return Number (item);
    }

    var arr:Array;

    ARR = myString.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s + /);

    ARR = map (str2Num, null);

    or combine them all in a single statement

    ARR = myString.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s + /) .map (str2Num, null);

  • How can I add a \n line break in a string?

    How can I add a line break in a string?
    \n doesn't seem to work.

    I'm passing a string to my message to the alert box, but the string is too long.

    Hello

    SQL> SELECT 'HELLO'||'WORLD' AS VALUE
      2  FROM DUAL;
    
    VALUE
    ----------
    HELLOWORLD
    
    SQL> SELECT 'HELLO'||CHR(10)||'WORLD' AS VALUE
      2  FROM DUAL;
    
    VALUE
    -----------
    HELLO
    WORLD
    

    BTW maximum lenth of alert is 200 characters. If character length will be more then 200 high he'll jump either you add new line or display the text as it is.

    -Clément

  • 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).

  • 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.

  • remove the editfield line break

    Hi I have a newline removal of difficulty of editfield. The situation is that I have editfield and the user inserts the body of the text.

    When the user clicks on a button, I want all the characters than insert user to show online with no spacing or no line breaks. I used StringUtilities.removeChar (String, "") to remove the empty spaces, but I don't know how to remove line breaks ("feed").

    Please help and thank you!

    Thanks for the suggestion, but I found a simple way using two Editifields!

Maybe you are looking for

  • Aurora up-to-date constantly repeating.

    8.0a2 same day Aurora constantly repeating. Automatic update has been applied several times and the update of the manual has even been downloaded applied once. I wonder always up-to-date Aurora with the same update of 8.0a2. Browser is currently disp

  • Can I transfer my subscription to Apple's music

    The woman has children attached to its AppleID for family sharing.  I have the Apple music account and children would like to support my subscription of Apple's music.  But, since they have already joined in the account of the wife through sharing of

  • Aspire Z5600 stuck in a kind of test monitor mode

    The screen of my Acer is just cycling blue/stripes/black white/grey/red-green-blue-white-black after a hard reboot back I can log in remotely so that can see that it's OK and work. Any ideas how to bring back to life?

  • Where can I download help and tools?

    I want to install PC Help & Tools, but I can't find it anywhere. I hope someone can help. I have Hp Pavilion dv6. Thank you

  • a small banner is displayed in the lower left corner of the desktop

    original title: embarrassing banner. When I turn on my laptop with vista premium acer5535, a small banner is displayed in the lower left corner of the desktop. It is a number of viewkey relating to a site, I'm not sure that my wife would want me to l