Skip to main content
Sawlay
Participating Frequently
April 2, 2012
Question

adding new line and sapaces in between the text in AI Script

  • April 2, 2012
  • 2 replies
  • 848 views

areaText.contents = "This is an Area Text in a rectangle. See how it flows to the next line.";

/*

i want to break the sentance from 'Text' ie i want to add new line in between and also some more spaces can any one plz help

*/

for example

I want to write the above text like this way

this is an Area

Text in a rectangle.   See

    how it       flows to the

next line  

This topic has been closed for replies.

2 replies

Inspiring
April 2, 2012

A screen grab with text invisibles switched on is always a good help…

CarlosCanto
Community Expert
Community Expert
April 2, 2012

that's a much better explanation, you didn't have to create another thread, you could have replied to my reply in the original thread.

we use the "\r" character to insert a new line and we can use "\t" to insert a "tab" for the spaces, or the actual spaces in a variable

var sixSpaces = "      ";

areaText.contents = "This is an Area\rText in a rectangle." + sixSpaces + "See\r" + sixSpaces + "how it" + sixSpaces + "flows to the\rnext line.";