Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)
Accepted Solution

automatic text reflow possible?

screenshots below.

 

Is there any way to force a label to automatically continue onto the next line should it automatically overflow its X bounrries?

 

overflow.png

 

in this example, everything after the R (orism) should move to the next line below. inside the UPPER box with green boundries.

 

 

the top label is configured as:

 

 

//CONTAINER:  (this is the UPPER box with thin green margins)

c.margins = Vector.<Number>([5,5,5,5]);
c.flow = ContainerFlow.VERTICAL;
c.sizeUnit = SizeUnit.PERCENT;
c.size = 35;
c.padding = 2;
c.debugColor = 0x00FF0A;


// create a text format for the text in the label			
WordFormat.size=50;																 
WordFormat.align = TextFormatAlign.JUSTIFY;
			
			
// adjust settings for the actual content of label								

WordText.autoSize = TextFieldAutoSize.CENTER;

// put the word, and label in the container
c.addChild(WordText);

 

Thanks for looking!

 

- - - - - - - - - -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: automatic text reflow possible?

hey dtater,

 

try doing the following:

 

 

//CONTAINER:  (this is the UPPER box with thin green margins)

c.margins = Vector.<Number>([5,5,5,5]);
c.flow = ContainerFlow.VERTICAL;
c.sizeUnit = SizeUnit.PERCENT;
c.size = 35;
c.padding = 2;
c.debugColor = 0x00FF0A;


// create a text format for the text in the label
WordFormat.size=50;
WordFormat.align = TextFormatAlign.JUSTIFY;


// adjust settings for the actual content of //label

//get rid of this
//WordText.autoSize = TextFieldAutoSize.CENTER;

WordText.wordWrap = true;

//assuming you know the width of the container
//set the height and width separately

WordText.width = c.width;
WordText.height = WordText.textHeight + 5;

// put the word, and label in the container
c.addChild(WordText);

 

hope that clears things up. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 158
Registered: ‎01-11-2010
My Device: 9700 | 9900 | PlayBook | Dev Alpha
My Carrier: Many :)

Re: automatic text reflow possible?

I have tried to do The sizing as you're suggesting, but that does not work as The 'c' in that code does not have any objects added to it (and therefore no size) until AFTER The text (with a set size) is added.

 

I was able to get around this with some experimentation and hard coding The text size.

 

The wordwrap property was EXACTLY what I needed.

 

Thanks again!  Have some Kudos!

 

-----

 

 

ALSO, you helped me quash The last major bug in my very first AScript Application.  I have a few more small things to polish up, and then I'll be ready for App World SUBMISSION!

 

 

While you are not The only one who has helped me out, JRab, I want to personally thank you as you have been, by far, The biggest contributor to my posts!

- - - - - - - - - -
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: automatic text reflow possible?

ahh man no problem at all! just glad i could help out - i too am a first time AIR developer so i know how difficult it can be doing wat we do. and i 100% agree this forum is full of people willing and able to help - hence why im still around, great environment Smiley Happy

 

its super awesome to hear you jumped the last hurdle. good luck on your submission and all your future submissions dtater!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman