I want to add a newline to a string text and I was wondering if there is a newline constant in actionscript 3? For example in .net there is an Environment.NewLine that is a string, containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms.
6 Answers
3
votes
The cheat sheet for migration from AS2 to AS3 states:
newline
Removed
Use the escape sequence composed of the backslash character followed by the character "n" (\n).
In other words, there is no such constant in AS3. Flash, in general, has the advantage of "being it's own platform", so you can get away with some platform dependencies.
2
votes
2
votes
You need not do that if you're trying to display string in your SWF, because your string is displayed on Flash player that uses \n
for newlines.
If you're trying to create a file based on the OS (to be saved onto the local machine maybe), you can check the OS using the static variable flash.system.Capabilities.manufacturer
1
votes