You can try measureText()

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of ivansebastiansurya
Sent: Saturday, July 25, 2009 7:08 AM
To: [email protected]
Subject: [flexcoders] Measuring the width of a label



Hi everyone,

I'm having a problem regarding measuring the width of a Label control.
In my item renderer, I need to display a list of labels, but the number of 
labels per row depends on how many of them fit within one row.
To do that, I need to actually measure the width of the label created prior to 
being added as a child of my renderer.
Anyone has any idea how to do that?

I need something like:

var label:Label = new Label();
label.text = "Test label";
// Then I need to measure the width of the created label.

Cheers and thanks in advance for reading my post.

Ivan.

Reply via email to