View Full Version : new line ("\n") being ignored
_forumSteve
November 25th, 2008, 07:11 PM
I'm loading some text from XML into a class variable. When using the variable to set the text of a Textfield instance, the "\n" is ignored. Any idea why?
My workaround is:
textfield.text = object.name.split( "\\n (file://\\n)" ).join( "\n" );
Is there a better solution?
Dom_
November 26th, 2008, 07:46 AM
I had this problem once, I came up with pretty much the same hack, I have no idea why the \n is ignored.
this might help (http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=665&threadid=1386999), i didnt read it all but you might find some answers.
arosemena
November 26th, 2008, 10:15 AM
check that the textfield have the multi-line option and that it isnt in single-line
_forumSteve
November 26th, 2008, 11:00 AM
I guess I'll stick with my workaround. It appears that, when retrieving the attribute from the loaded XML, its interpreting "\n" as "\\n"...
trace( object.name == "A\nB" ) displays false;
trace( object.name == "A\\nB" ) displays true;
This behavior is different from an XML object created as frame script.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.