Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
03-25-2011 03:18 PM
I'm developing an ActionScript 3 app for Playbook.
I have an XML file with some texts. One of them is a big string. I want to show it in the following Label:
var label32:Label = new Label(); label32.setPosition(5, 5); label32.setSize(100, 100); label32.multiline = true; label32.autoSize = TextFieldAutoSize.LEFT; label32.embedFonts = true; label32.textField.antiAliasType = AntiAliasType.ADVANCED; label32.textField.sharpness = 1; label32.textField.thickness = 25; label32.textField.gridFitType = GridFitType.PIXEL; label32.format = instrucTextFormat; label32.text = loadString(4, getUserLanguage());
I have added '\n' inside the string to split it, but it doesn't work.
If I use html, can I add HTML tags inside an XML file?
03-25-2011 03:49 PM - edited 03-25-2011 03:52 PM
Since you have a the label to multline = true it will show on multiple lines when you set the width property to a static value. You shouldn't need to put \n or use html.
but you should be able to put break tags in the xml just make sure to use the CDATA[ "html" ] when you do it if you choose to use html
03-25-2011 05:55 PM
03-25-2011 10:44 PM
L7 is right. The text will wrap. Still, if you are looking to break the line at a specific point using the new line character you should be able to.
label.text ="line1\nline 2"; will in fact yield:
If your text is not wrapping or you still fail to get multiple lines using \n I suggest you at least trace the string to make sure its correct. When tracing it, you should see multiple lines if using \n. If you do not, then check your string.
03-26-2011 01:43 AM
I've tried all of yours solutions, and it doesn't work for me.
Above, I put the code that it's not working. Multiline doesn't work here and '\n' caracter either.
I'm using htmlText with <BR> and works fine.
03-26-2011 12:20 PM
glad htmlText is doing the trick for you. You mention your code sample, but there's no way for us to know what your loadString() function is returning which is why I suggested tracing it. If you're content with how it works now then you're all set.
Just out of curiosity, did you ever trace the output of that function? If so, did you get the line breaks on the console window?
03-26-2011 12:23 PM
Suppose that loadString() returns a String like this:
"function is returning which is why I suggested tracing it. If you're content with how it works now then you're all set. Just out of curiosity, did you ever trace the output of that function? If so, did you get the line breaks on the console window?"
03-26-2011 12:59 PM
Don't worry, it's working with htmlText.
I'm using \n like this:
function is returning which is why I suggested tracing it. If you're content with how it works now then you're all set.\nJust out of curiosity, did you ever trace the output of that function? If so, did you get the line breaks on the console window?
I've added a \n at the beginning of line 2.