Re: [flexcoders] Re: Measuring the width of a label

2009-07-28 Thread Rohit Sharma
  But measureText() or measureHTMLText() will measure the width of the whole
text
  after considering the current styles for the component. So, it will take
care of different
  letters as well as different fonts.

On Tue, Jul 28, 2009 at 12:07 AM, valdhor valdhorli...@embarqmail.comwrote:



 The problem you are going to face is that different fonts have different
 widths for different characters. For example, an i is thinner than an o.
 You could try using a fixed width font and then counting characters.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
 ivansebastiansurya ivansebastiansu...@... wrote:
 
  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.
 

  



[flexcoders] Re: Measuring the width of a label

2009-07-27 Thread valdhor
The problem you are going to face is that different fonts have different widths 
for different characters. For example, an i is thinner than an o. You could 
try using a fixed width font and then counting characters.


--- In flexcoders@yahoogroups.com, ivansebastiansurya 
ivansebastiansu...@... wrote:

 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.