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:

/**
 *  @copy mx.core.UIComponent#percentWidth
 */
public function get percentWidth():Number
{
	return NaN;
}

/**
 *  @private
 */
public function set percentWidth(value:Number):void
{
}

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!

About the Author

Josh Tynjala is an indie game developer, entrepreneur, Flash and Flex mercenary, and bowler hat enthusiast.

Discussion
  1. tried TextArea for multiline?

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

    posted by Josh Tynjala on 10.03.2006
  3. 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.

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

    posted by Josh Tynjala on 10.18.2006
  5. 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.

    posted by Jesse Couch on 10.18.2007
  6. 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.

    posted by Josh Tynjala on 10.18.2007
Share Your Thoughts

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

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>