flex中的视图

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private function check(name:String,password:String):Boolean{
return (name=="123"&&password=="123")?true:false;
}
]]>
</mx:Script>
<mx:states>
<mx:State name="Register">
<mx:AddChild relativeTo="{loginForm}" position="lastChild">
<mx:FormItem id="confirm" label="确认密码:">
<mx:TextInput/>
</mx:FormItem>
</mx:AddChild>
<mx:SetProperty target="{loginPanel}" name="title" value="注册"/>
<mx:SetProperty target="{loginButton}" name="label" value="注册"/>
<mx:RemoveChild target="{registerLink}"/>
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:LinkButton  label="返回到登录" click="currentState=''"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:states>//multiple initalizers for states ?????
<mx:State name="Login">
<mx:AddChild relativeTo="{loginForm}" position="lastChild">
<mx:FormItem id="confirm1" label="确认密码:">
<mx:TextInput/>
</mx:FormItem>
</mx:AddChild>
<mx:SetProperty target="{loginPanel}" name="title" value="注册"/>
<mx:SetProperty target="{loginButton}" name="label" value="注册"/>
<mx:RemoveChild target="{registerLink}"/>
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:LinkButton  label="返回到登录" click="currentState=''"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Panel id="loginPanel" title="登录"  fontSize="12" x="165" y="141">
<mx:Form id="loginForm">
<mx:FormItem label="用户名:">
<!--textinput的id is not name-->
<mx:TextInput id="n"/>
</mx:FormItem>
<mx:FormItem label="密码:">
<mx:TextInput id="password"/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:LinkButton id="registerLink" label="还未注册" click="currentState='Register'"/>
<mx:Spacer width="100%" id="spacer1"/>
<mx:Button label="登录" id="loginButton" click="currentState='Login'"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>
哪位大牛能给俺指示

你可能感兴趣的:(xml,Flex)