Flex 2 UITextFields don’t allow percentage dimensions

by Josh Tynjala

FYI, the documentation doesn't say anything about it, but the percentWidth and percentHeight properties don't work on UITextField instances in Flex 2. Here's the spartan implementation of the percentWidth property:

Actionscript:
  1. /**
  2. *  @copy mx.core.UIComponent#percentWidth
  3. */
  4. public function get percentWidth():Number
  5. {
  6.     return NaN;
  7. }
  8.  
  9. /**
  10. *  @private
  11. */
  12. public function set percentWidth(value:Number):void
  13. {
  14. }

The documentation states that these properties may be set to values from 0 to 100. I've submitted a bug report, but I thought I'd send out a warning.

I guess it's time for a little subclassing. I've been having a lot of frustration with text-based components in Flex. Labels can only be a single line. UITextField seems to be the best bet for multiline text because the Text component is a horrible pain in the rear that doesn't seem to like word-wrapping. Flex team developers, if you're listening, I want better text-based components!

6 Comments

Tink

tried TextArea for multiline?

Josh Tynjala

I suppose turning off all the skinned parts and making it non-editable would work. That seems a little strange, though.

Campbell

Yeah I have stumbled across many things such as this. Having the framework source there is invaluable for bug fixing. Unfortunately they swallow errors such as this instead of rasing some sort of debug level error. Oh well.

Josh Tynjala

FYI, the documentation error has been acknowledged by Adobe’s QA department, and it will be fixed.

Jesse Couch

has this bug been fixed in any of the hot fixes?!!!!!!!!!!!!

this is a horrible bug, TextAera doesn’t work to my needs.

this bug pretty much destroys any nice text resizing/scaling.

what a horrible bug. so horrible. man. i like flash so much better, but i have to use flex for work. flex 3 is almost public, maybe it will have less bugs.

Josh Tynjala

Jesse, I just checked. The documentation has been updated for the percentWidth and percentHeight properties of UITextField in Flex 3. It now says, “This property is always set to NaN for the UITextField control.” There’s no indication that the behavior has changed.

Leave a Comment

Note: New comments may need to be approved before they appear.

Some HTML allowed in comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

To display code in comments: <pre>Code here. May be multiline. Format XML with &gt; and &lt; entities.</pre>