<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
currentState="Login">
<s:states>
<s:State name="Login"/>
<s:State name="Portal"/>
</s:states>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<s:Sequence id="shake"
target="{loginPanel}"
duration="100">
<s:Move xBy="20"/>
<s:Move xBy="-20"/>
<s:Move xBy="20"/>
<s:Move xBy="-20"/>
<s:Move xBy="20"/>
<s:Move xBy="-20"/>
</s:Sequence>
<s:Move xBy="20"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
private function checkLogin():void
{
if(username.text == "flex" && password.text == "123")
{
currentState = "Portal";
}
else
{
shake.play();
}
}
]]>
</fx:Script>
<s:Panel id="loginPanel"
includeIn="Login"
x="83" y="112" width="354" height="261"
title="Login">
<s:Label x="116" y="47" text="UserName"/>
<s:TextInput id="username" x="116" y="67"/>
<s:Label x="116" y="101" text="Password"/>
<s:TextInput id="password" x="116" y="121" displayAsPassword="true"/>
<s:Button id="button" x="141" y="180" label="Submit" click="checkLogin()"/>
</s:Panel>
<s:Panel includeIn="Portal"
x="250" y="109"
width="250" height="200"
title="Portal">
</s:Panel>
</s:Application>
Flex学习笔记(五) 动画效果
最新推荐文章于 2024-08-24 16:39:10 发布