Re: [Flashcoders] Measuring the height of a dynamically created text field.

2005-10-25 Thread David Lochhead
Thanks guys.

If only I had known about the getTextExtent() method before! Back to
school for me!

Thanks again,

Dave

On 10/24/05, Michael Klishin [EMAIL PROTECTED] wrote:
 David Lochhead wrote:

  This outputs 16 for the height and 300 for the width. The actual
  height of the textfield, via the debugger, is 160.

 And what does object returned by getTextExtent() method say if you use
 wrap margin parameter? For me this way always works fine. But if you use
 HTML-rendering text fields...

 --
 Michael Klishin,
 [EMAIL PROTECTED]


 Non progredi est regredi
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Measuring the height of a dynamically created text field.

2005-10-24 Thread David Lochhead
Hello,

Is there anyway to measure the height of a dynamically created
textfield without moving onto the next frame?

Here's my test code.

writeTestField = function () {
this.createTextField(my_txt, 1, 50, 50, 300, 1);
my_txt.type = dynamic;
my_txt.autoSize = true;
my_txt.border = false;
my_txt.background = false;
my_txt.password = false;
my_txt.multiline = true;
my_txt.html = false;
my_txt.embedFonts = true;
my_txt.selectable = false;
my_txt.wordWrap = true;
my_txt.mouseWheelEnabled = true;
my_txt.condenseWhite = false;
my_txt.restrict = null;
my_txt.variable = null;
my_txt.maxChars = null;
my_txt.styleSheet = undefined;
my_txt.tabInded = undefined;
//
// SET THE TEXT
my_txt.text = Vel commodo hendrerit consequat, et augue, odio
facilisis, eu tation odio iriure. Adipiscing, eum, dolor et, vel
aliquip nostrud tincidunt, in luptatum nostrud feugait duis. Exerci in
minim iusto sit in, qui feugiat consequat, dignissim vel adipiscing
duis dignissim lorem feugait. Autem molestie, et quis elit molestie
delenit aliquam eum luptatum feugiat nonummy nulla luptatum vel
commodo illum. Ut qui ullamcorper, in. Augue vel, wisi, ad lobortis at
esse facilisis dolore dolor vel laoreet dolore tation. Aliquip esse
ex, feugiat eros nostrud, ex. Hendrerit illum et eu vulputate in erat
eu, nisl duis, illum duis at iusto ullamcorper duis. Nulla, feugiat ad
at tation quis facilisis at ea feugait aliquip lorem ut blandit
praesent, ut. Eum esse facilisis consequat dolor vel laoreet dolore
tation nisl, esse, ex eu, eros quis ex. Illum, vel eros eu vulputate
dolor erat eu nisl augue illum te, magna iusto odio.;
// APPLY FORMATTING
my_txt.setTextFormat(my_fmt);
// now we test the height
traceFieldSize();
};
traceFieldSize = function () {
trace(my_txt._height);
trace(my_txt._width);
};
//
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = pixel_reg;
my_fmt.size = 8;
my_fmt.leading = 100;
my_fmt.color = 0x00;
my_fmt.bold = false;
my_fmt.italic = false;
my_fmt.underline = false;
my_fmt.url = ;
my_fmt.target = ;
my_fmt.align = left;
my_fmt.leftMargin = 0;
my_fmt.rightMargin = 0;
my_fmt.indent = 0;
my_fmt.leading = 0;
my_fmt.blockIndent = 0;
my_fmt.bullet = false;
//
writeTestField();

This outputs 16 for the height and 300 for the width. The actual
height of the textfield, via the debugger, is 160.

If I trace the height of the textfield on the next frame it's 160, the
correct size.

Is there a mathod to get the correct field height without going to the
next frame?

Cheers,

Dave
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders