Controlling Dynamic Text

I’ve recently learned how to Actionscript text into a Dynamic Text box, with a specific variable name. Nothing too complicated, just basic AS that says:

option.textblock = "Text to be displayed goes here";

Now, by cutting and pasting from HTML, i accidentally discovered that there are ways of formatting the text that involve a back(or front, im not sure)-slash. ’ \ ’

Here is an example:

option.textblock = "Text in line 1.
Text in line 2";

the \r and the
tell the text to break to the next line, and then start a new paragraph, though im not sure which does which. My question is, what are the other possibilities for this type of formatting, and more specifically, how can i make certain text bold?

(i’ve already tried ‘\b’ and it just makes a little box.) Any input, links, or help would be greatly appreciated.

Thanks in advance. <:}

\r and
represent the characters CARRIAGE RETURN and NEWLINE (aka LINEFEED). What the slash means is that its an ‘escape’ character. This is a way to represent a single text character in code that would normally not function in code - new line characters being a prime example of that. Another example is the tab character, which in code looks like " ". In terms of Flash, the \r and
, they’re pretty much the same. However, operating systems handle them differently when dealing with textfiles to determine when one line ends and a new line begins. For example:

  • On UNIX, text line endings are ended with a newline (
    ).
  • On Windows, line endings are ended with both a carriage return AND a newline (
    ).
  • While on the Mac (OS 9 and below), they end with a single carriage return (\r).
  • Whereas Mac OS X, being based on BSD, uses the unix newline (
    ).

What this means for Flash is a couple of things. 1) importing formatted text from the windows platform which contains line breaks will be double spaced because Windows uses both \r and
2) having files coming from differing platforms means an inconsistency in the characters used in determining line breaks so if you try to remove/replace/find them, extra steps are needed to allow for that.

The character used by default by Flash is \r.
however, is commonly used in coding when including new lines into strings. Both are interpreted as new lines in Flash, so either will work. The problem comes in Windows formatted code where there are both \r and
characters for one new line. Some text editors like SciTE allow you to edit around this - something to look into when creating text for Flash, especially when loaded in externally.

YET, that still doesnt answer the question of bold vs new lines. The answer to that is that they are handled entirely different.

In Flash 5, HTML was used - using bold and italic tags in an html formatted textfield to format your text. HTML can still be used in MX in the same way, but MX also has the textFormat object, which basically puts all the options you have in the properties panel for a textField into script so actionscript can control that. I wont get into it here because I doint have time :wink: but you can check flash help and search the web on that for more info

search

newline
searchnewline
return
carriage return

\r
unix mac windows
line break breaks

thanks for the input, senocular.

can
and and \r work when you load an external text file?

I think you can, jonnooe… :wink: