Monday, January 29, 2007

Can you find the BUG!

This problem was post on the Flex 2 Forum. This problem only happens with the Flex 2.01 release. Can you find the bug? The answer is posted here


BUG DESCRIPTION: errorString property is causing a buggy behavior, if i set an empty String to this property in order to clean a validation error for a TextInput control then its layout changes, it gets a weird black color on its border.

EXAMPLE:

&#60; mx:application><mx:textinput id="buggy"></mx:textinput><mx:button label="Show Bug" click="buggy.errorString = ''"></mx:button></mx:application>


mx_internal var origBorderColor:Number;

/** A bunch of Code Here**/

/**
* @private
* Set the appropriate borderColor based on errorString.
* If we have an errorString, use errorColor. If we don't
* have an errorString, restore the original borderColor.
*/
private function setBorderColorForErrorString():void
{
if (!_errorString _errorString.length == 0)
{
setStyle("borderColor", origBorderColor);
saveBorderColor = true;
}
else
{
// Remember the original border color
if (saveBorderColor)
{
saveBorderColor = false;
origBorderColor = getStyle("borderColor");
}
setStyle("borderColor", getStyle("errorColor"));
}
styleChanged("themeColor");
var focusManager:IFocusManager = focusManager;
var focusObj:DisplayObject = focusManager ?
DisplayObject(focusManager.getFocus()) :
null;
if (focusManager && focusManager.showFocusIndicator &&
focusObj == this)
{
drawFocus(true);
}
}

1 comment:

Anonymous said...

yes it's true
i have this problem and i decide to cghange script
------------------
Madonna