If you look at TextArea's updateDisplayList, you can see how the
textfield gets sized using viewmetrics.  You want to replicate that in
your measure function.

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Guillermo Villasana
Sent: Wednesday, September 19, 2007 12:43 PM
To: [email protected]
Subject: Re: [flexcoders] Problem with sizing

Well after I resize the element I was using the measureHeight to get the

height and pass it to other components.
Could you post an example with the viewMetrics.
Thanks


Alex Harui wrote:
>
> Not sure why you're not using Text instead of TextArea.
>
> If you don't copy the sizing algorithm of the TextArea's internal 
> textfield, then your measurments won't be correct. I don't think -10 
> is going to be right and I don't understand 3.9 either. The code is 
> much simpler than that. It uses viewMetrics.
>
>
------------------------------------------------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED]

> *On Behalf Of *Guillermo Villasana
> *Sent:* Wednesday, September 19, 2007 10:45 AM
> *To:* [email protected]
> *Subject:* [flexcoders] Problem with sizing
>
> Hi everyone, well I am still having problems with resizing a Text
Area.
> At the moment I am using this code:
>
> package mylib
> {
> import mx.controls.TextArea;
> import flash.text.TextField;
> import mx.controls.Alert;
> public class AdvancedTextArea extends TextArea
> {
> public function AdvancedTextArea() {
> super();
> this.editable=false;
> this.selectable=false;
> this.verticalScrollPolicy="off";
> this.horizontalScrollPolicy="off";
>
> }
>
> override protected function measure():void
> {
> super.measure();
> var myTF:TextField=new TextField();
> var altoxLineas:Number=new Number();
> myTF.wordWrap=true;
> myTF.text=text;
> myTF.width=explicitWidth-10;
> altoxLineas=myTF.numLines*3.9+altoxLineas/3.9;
> measuredHeight = measuredMinHeight =
> myTF.textHeight + 10;
> if (altoxLineas>myTF.textHeight) measuredHeight
> = measuredMinHeight = altoxLineas + 10;
> }
> }
> }
>
> Although it does grows my Textarea, in some cases it doesn't grow it
> enough... Any pointers would be appreciated.
>
>  



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



Reply via email to