Actionscript 3 requiredFieldError不起作用

Actionscript 3 requiredFieldError不起作用,actionscript-3,actionscript,flex4,Actionscript 3,Actionscript,Flex4,这似乎是一个编写正确的代码,但当我尝试跳过名字字段时,并没有收到错误消息。取而代之的是,我看到一个带感叹号的小黄色三角形,它出现在名字字段旁边。为什么会这样?谢谢 <fx:Declarations> <s:RadioButtonGroup id="phoneRadioButtonGroup"/> <mx:StringValidator id="firstNameValidator" source="{firstNameTextInput}"

这似乎是一个编写正确的代码,但当我尝试跳过名字字段时,并没有收到错误消息。取而代之的是,我看到一个带感叹号的小黄色三角形,它出现在名字字段旁边。为什么会这样?谢谢

<fx:Declarations>
    <s:RadioButtonGroup id="phoneRadioButtonGroup"/>
    <mx:StringValidator id="firstNameValidator" source="{firstNameTextInput}"
    property="text" requiredFieldError="This field is required" required="true"/>
    <mx:StringValidator id="lastNameValidator" source="{lastNameTextInput}" 
    property="text" required="false" tooShortError="Please enter at least four characters" minLength="4"/>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form width="380" height="615" backgroundColor="#56A1B9">
    <s:FormHeading label="Contact Editor"/>

    <s:FormItem width="252" height="36" label="First Name" required="true">
    <s:TextInput id="firstNameTextInput"/>
    </s:FormItem>

    <s:FormItem width="251" height="36" label="Last Name" required="false"> 
    <s:TextInput id="lastNameTextInput"/>
    </s:FormItem>

    <mx:HRule width="100%" height="15"/>

    <s:FormItem width="252" height="37" label="Email" required="true">
    <s:TextInput id="emailTextInput"/>
    </s:FormItem>

将必填字段设置为。。 并设置errorMessage=“所需消息”


这将解决问题

据我所知,在这个框架中,三角形中的小感叹号是“必填字段未填充”的错误消息。这是许多表单的默认设置。不过我不知道该怎么改变。谢谢你的帮助。我发现了为什么会这样。出于某种原因,如果我将表单设置为spark组件,它将不起作用。使用mx,它可以很好地工作,确保您回答自己的问题并接受您的答案。