创建了两个文本字段,我必须对其进行验证并在警报框中显示错误消息。在 4.5 中,不支持 mx.controls.Alert。我尝试从源路径中包含 mx 。请帮助我如何通过验证文本字段为空来显示警报框..
<code>
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="validation">
<fx:Declarations>
<fx:Component className="AlertMsg">
<s:SkinnablePopUpContainer x="70" y="100">
<s:TitleWindow title="My Message" close="close()">
<s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
<s:Label text="My alert message text here..."/>
<s:Button label="OK" click="close()"/>
</s:VGroup>
</s:TitleWindow>
</s:SkinnablePopUpContainer>
</fx:Component>
</fx:Declarations>
<s:layout>
<s:VerticalLayout paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5" gap="10"
horizontalAlign="center" verticalAlign="top"/>
</s:layout>
<s:TextInput id="firstName"/>
<s:TextInput id="zipCodeInput"/>
<s:Button label="Show Alert" click="(new AlertMsg()).open(this, false)"/>
</s:View>
</code>
这里警报显示在 fx:declaration 中。如何通过验证文本字段来显示警报消息。请帮助