这是一个最小的Flex应用程序,它具有RichEditableText长度的验证器:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
minWidth="955" minHeight="600"
>
<fx:Declarations>
<mx:NumberValidator id="titleLenValidator"
exceedsMaxError="Your text is too long. As a result some of it is not shown."
maxValue="60"
property="contentHeight"
source="{titleLabel}"
>
</mx:NumberValidator>
</fx:Declarations>
<s:RichEditableText id="titleLabel"
text="very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long very long "
maxHeight="40" width="400"
y="400"
fontSize="20"
>
</s:RichEditableText>
<s:Button>
</s:Button>
</s:Application>
问题是,当文本框的内容向下滚动时,验证器随之向上移动,最终结果如下所示:
如何调整验证器弹出窗口的位置,使其不在内容的位置之上,而是在控件本身的顶部?
答案 0 :(得分:1)
对于spark表单验证,你应该将RichEditableText包装到FormItem中,以防你需要一些自定义布局(例如非默认位置的错误字符串) - 你应该为FormItem创建外观并更改内部布局(例如更改错误字符串标签位置)