View Full Version : :: ActionScript Text Animation -- line breaks?
zaptheman
April 13th, 2003, 11:41 PM
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
zaptheman
April 14th, 2003, 02:25 AM
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?
blah-de-blah
April 14th, 2003, 06:29 AM
i thought '/n' makes a new line? i'm not entirely sure but i think that thing makes a new line...
nemoBejingler
April 14th, 2003, 03:59 PM
make sure the textbox has HTML code checked and then use
%0D to make a new line
zaptheman
April 14th, 2003, 09:39 PM
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!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.