[flexcoders] Re: TextField - how does it calculate the number of lines?

2008-05-06 Thread Dmitri Girski
Anyone?




--- In flexcoders@yahoogroups.com, Dmitri Girski [EMAIL PROTECTED] wrote:

 Question to Alex and the rest from Adobe gang:
 
 Why the TextField does not include in numLines the number of lines
 which ends up with CR or LF?
 
 I.e. if you have a text:
 
 Mary has a little lambCR (1)
 Mary has a little lambCR (2)
 
 And the width of TextField is big enough to accommodate the whole
 string (1) without breaking it. 
 
 TextField thinks that it has 2 lines. But when it starts rendering
 text it places the CR symbol and we ending up with 4 lines of text. 
 
 Is this a bug or feature?
 
 PS this is .text property, not the .htmlText (which has similar
 problem of missing the brs from the count) 
 
 
 Thanks!





RE: [flexcoders] Re: TextField - how does it calculate the number of lines?

2008-05-06 Thread Alex Harui
Sorry, haven't gotten around to it yet.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Dmitri Girski
Sent: Tuesday, May 06, 2008 8:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: TextField - how does it calculate the number
of lines?

 

Anyone?

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Dmitri Girski [EMAIL PROTECTED] wrote:

 Question to Alex and the rest from Adobe gang:
 
 Why the TextField does not include in numLines the number of lines
 which ends up with CR or LF?
 
 I.e. if you have a text:
 
 Mary has a little lambCR (1)
 Mary has a little lambCR (2)
 
 And the width of TextField is big enough to accommodate the whole
 string (1) without breaking it. 
 
 TextField thinks that it has 2 lines. But when it starts rendering
 text it places the CR symbol and we ending up with 4 lines of text. 
 
 Is this a bug or feature?
 
 PS this is .text property, not the .htmlText (which has similar
 problem of missing the brs from the count) 
 
 
 Thanks!


 



[flexcoders] Re: TextField - how does it calculate the number of lines?

2008-05-06 Thread Dmitri Girski
No problem, Alex!

I just found this thing while printing the contents of TextArea and I
am not sure is this a bug or not. 

Thanks!
Dmitri.




--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Sorry, haven't gotten around to it yet.
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Dmitri Girski
 Sent: Tuesday, May 06, 2008 8:21 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: TextField - how does it calculate the number
 of lines?
 
  
 
 Anyone?
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Dmitri Girski mitek17@ wrote:
 
  Question to Alex and the rest from Adobe gang:
  
  Why the TextField does not include in numLines the number of lines
  which ends up with CR or LF?
  
  I.e. if you have a text:
  
  Mary has a little lambCR (1)
  Mary has a little lambCR (2)
  
  And the width of TextField is big enough to accommodate the whole
  string (1) without breaking it. 
  
  TextField thinks that it has 2 lines. But when it starts rendering
  text it places the CR symbol and we ending up with 4 lines of text. 
  
  Is this a bug or feature?
  
  PS this is .text property, not the .htmlText (which has similar
  problem of missing the brs from the count) 
  
  
  Thanks!
 





RE: [flexcoders] Re: TextField - how does it calculate the number of lines?

2008-05-06 Thread Alex Harui
I get 3 using \n, and 5 using \r\n with this test:

 

package {

 

import flash.display.*; 

import flash.events.*;

import flash.filters.*;

import flash.geom.*;

import flash.net.*;

import flash.system.*;

import flash.text.*;

import flash.ui.*;

import flash.utils.*;

import flash.xml.*;

 

public class test2 extends MovieClip

{

public var thing1:Sprite;

public var thing2:Sprite;

public var thing3:Sprite;

public var thing4:Sprite;

public var thing5:Loader;

public var thing6:Loader;

public var max:TextField;

 

public function test2()

{

super();

root.loaderInfo.addEventListener(Event.INIT, initialize);

 

}

 

public function initialize(event:Event):void

{

thing1 = new Sprite();

trace(thing1.name);

addChild(thing1);

thing1.graphics.beginFill(0xFF);

thing1.graphics.drawRect(0, 0, 500, 500);

thing1.graphics.endFill();

 

max = new TextField()

thing1.addChild(max);

max.x = 10;

max.y = 200;

max.width = 500;

max.height = 100;

max.multiline = true;

max.text = Mary had a little lamb\r\nMary had a little lamb\r\n;

 

trace(max.numLines);

 

addEventListener(mouseDown, mouseDownHandler)

}

 

private function mouseDownHandler(event:Event):void

{

trace(max.numLines);

}

 

 

}

 

 

}

 

 

 

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Dmitri Girski
Sent: Tuesday, May 06, 2008 8:21 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: TextField - how does it calculate the number
of lines?

 

Anyone?

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Dmitri Girski [EMAIL PROTECTED] wrote:

 Question to Alex and the rest from Adobe gang:
 
 Why the TextField does not include in numLines the number of lines
 which ends up with CR or LF?
 
 I.e. if you have a text:
 
 Mary has a little lambCR (1)
 Mary has a little lambCR (2)
 
 And the width of TextField is big enough to accommodate the whole
 string (1) without breaking it. 
 
 TextField thinks that it has 2 lines. But when it starts rendering
 text it places the CR symbol and we ending up with 4 lines of text. 
 
 Is this a bug or feature?
 
 PS this is .text property, not the .htmlText (which has similar
 problem of missing the brs from the count) 
 
 
 Thanks!