By default, the MaxCharacterStatus will be invisible until the monitoredComponent gains focus. This behavior can be overridden by setting the
showOnFocusOut property to true.The status bar will lay on top of the border unless you add padding. This is only important if you want the status bar to be fully within the bounds of the monitored component, or if you're using custom borders.
Since the MaxCharacterStatus class is not an extension of TextArea or TextInput, it was intended to be attached to the displayList of the monitoredComponent. Why did I do it this way? Mainly to see if I could. I think in production I would simply override TextArea and TextInput, adding the bits to display the status bar. However, given that it's meant to be injected into it's host component, it is recommended to be instantiated in a creationComplete event handler like so:
private function onCreationComplete( event:FlexEvent ):void
{
var mcs:MaxCharacterStatus = new MaxCharacterStatus(myTextInput);
myTextInput.addChild(mcs);
}
The
<bell:MaxCharacterStatus> tag inherits all of the tag attributes of its superclass (UIComponent), and adds the following tag attributes:Properties
monitoredComponent="{TextArea|TextInput}"
showOnFocusOut="false"
Styles
paddingBottom="0"
paddingLeft="0"
paddingRight="0"
paddingTop="0"
statusBarColor="0xFF0000"
verticalAlign="top|bottom"
A demo.
The MaxCharacterStatus source for download.
No comments:
Post a Comment