Responding again to my own posting... :-) 

I tried what I was thinking of below, and it works perfectly! Pixel-accurate
width is correctly returned every time. The same method can be used for
multiple entry fields, even with different typefaces or type styles as long
as those style parameters are passed to the auto-sized, off-stage
"measurement" field. 

Ville


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ville
Walveranta
Sent: Thursday, June 22, 2006 13:23
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] getTextExtent weirdness


I was recently working on a project where .getTextExtent() would have come
handy, but like for others, it did not work for me. I dropped the issue at
that time, but have been thinking of trying to create an auto-size field off
the stage with the same text style parameters as the textInput component,
then copy characters (from the input component as they're typed) to the
auto-sized field, then measure the width of the auto-sized field. If the
width exceeds the maximum allowed pixel-width, then disallow further typing
into the component. I think it should work... has anyone tried this?

Ville


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to