Flex 2 UITextFields don't allow percentage dimensions

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 Josh Tynjala

Josh Tynjala is a frontend developer, open source contributor, bowler hat enthusiast, and karaoke addict. You might be familiar with his project, Feathers UI, an open source user interface library for Starling Framework that is included in the Adobe Gaming SDK.

Discussion

  1. 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.

  2. 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.

  3. 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.