Revision: 54309
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 20, 2011 02:01 by adrianparr
Initial Code
var originalStr:String = "<p>Each<br>word<br>should<br>be<br>on<br>a<br>new<br>line.</p><p>\tThis line should be tabbed.</p><p>But this line shouldn't be tabbed.</p><p><li>Bullet points don't work though</li><li>Bullet points don't work though</li><li>Bullet points don't work though</li></p><p>Paste into Notepad to view the results!</p>"; var textfieldStr:String = unescape(originalStr); var tf:TextField = new TextField(); tf.multiline = true; tf.width = stage.stageWidth; tf.height = stage.stageHeight; addChild(tf); tf.htmlText = textfieldStr; var clipboardForNotepadStr:String = unescape(tf.text.replace(/\r/g, ' ')); System.setClipboard(clipboardForNotepadStr);
Initial URL
Initial Description
Linebreaks differ between Flash TextField and a plain text file like Notepad. In this example we convert the html linebreaks in Flash to \r\n
Initial Title
AS3 Convert TextField LineBreaks to CRLF for Display as Plain Text (Notepad) on Windows
Initial Tags
text, line
Initial Language
ActionScript 3