# :: ActionScript Text Animation -- line breaks?

**URL:** <https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170>\
**Category:** flash\
**Created:** [April 14, 2003, 3:41am UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170 "2003-04-14T03:41:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaptheman](https://avatars.discourse-cdn.com/v4/letter/z/c2a13f/32.png) [@zaptheman](https://forum.kirupa.com/u/zaptheman)\
**Post date:** [April 14, 2003, 3:41am UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170/1 "2003-04-14T03:41:21Z")

</div>

I’m using the text effect I found in  
[ActionScript Text Animation](http://www.kirupa.com/developer/actionscript/ascript_text_animation.htm) , and the script works great.

My question is, is it possible to have line breaks? I tried adding spaces to end a line, but you’d have to wait for the script to read through the added spaces before the next line begins.

Thanks!  
:cool:  
-zap

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 14, 2003, 6:25am UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170/2 "2003-04-14T06:25:22Z")

</div>

Still haven’t figured it out… ☹

My code looks something like this:

text = text\_variable01 + newline + text\_variable02;

Isn’t ‘newline’ supposed to get me a carriage return?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 14, 2003, 10:29am UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170/3 "2003-04-14T10:29:29Z")

</div>

i thought ‘/n’ makes a new line? i’m not entirely sure but i think that thing makes a new line…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 14, 2003, 7:59pm UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170/4 "2003-04-14T19:59:20Z")

</div>

make sure the textbox has HTML code checked and then use  
%0D to make a new line

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 15, 2003, 1:39am UTC](https://forum.kirupa.com/t/actionscript-text-animation-line-breaks/18170/5 "2003-04-15T01:39:08Z")

</div>

Thanks for the posts, guys!

But I figured it out on my own. 🙂

Here are my variables. I placed a non-displaying ASCii character where I want my line breaks (Alt + 0160).

//-----frame 1-----  
text = “1st line\_2nd line\_3rd line”;  
nXstart = 20;  
nYstart = 20;  
\_root.char.\_visible = false;  
nLength = length(text);  
nKerning = 11;  
nLLength = 60;  
nChars = 0;  
nLNumber = 1;  
nLSpace = 20;  
ii = 0;

In the original code, the text breaks when the number of characters (variable named nChars) reaches the maximum line length (variable named nLLength) and reaches a space (nReturn). I just removed the 1st part of the code (that checks if the nChars reaches nLLength) and placed my non-displaying ASCii character (Alt+0160) in place of the ‘space’ in the line if(nReturn == " "). Here’s the code, I’ve commented out the parts I removed.

//-----frame 3-----  
nChars++  
//-----if(nChars \>=nLLength) {-----  
nReturn = text.substr(ii, 1);  
if (nReturn == “\_”) {  
nLNumber = nLNumber+1;  
nChars = 0;  
}  
//-----}-----  
ii++;  
char.duplicateMovieClip(“char”+ii, ii);  
\_root[“char”+ii].mcLetter.text = text.substr(ii-1, 1);  
\_root[“char”+ii].\_x = nXstart+nChars_nKerning;  
\_root[“char”+ii].\_y = nYstart+nLNumber_nLSpace;

That’s it, nothing too funky. 🙂

More power to this site, you guys are really helping out a lot of developers!
