トランジションの簡単なサンプル

by nariyu
♥1 | Line 54 | Modified 2009-09-29 15:09:05 | MIT License
play

ActionScript3 source code

/**
 * Copyright nariyu ( http://wonderfl.net/user/nariyu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8PCi
 */

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
	xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="absolute">
	<mx:Script>
		<![CDATA[
            import mx.effects.easing.Bounce;
        ]]>
	</mx:Script>
	
	<mx:transitions>
		<mx:Transition fromState="*" toState="*">
			<mx:Parallel>
				<mx:Resize target="{loginPanel}" duration="500"/>
				<mx:Sequence target="{confirm}">
					<mx:Blur duration="200" blurYFrom="1.0" blurYTo="20.0" />            
					<mx:Blur duration="200" blurYFrom="20.0" blurYTo="1" />            
				</mx:Sequence>
			</mx:Parallel>
		</mx:Transition>
	</mx:transitions>
	
	<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:AddChild relativeTo="{registerLink}" position="before">
				<mx:LinkButton label="ログイン画面に戻る" click="currentState=''"/>
			</mx:AddChild>
			<mx:RemoveChild target="{registerLink}"/>
		</mx:State>
	</mx:states>
	
	<mx:Panel id="loginPanel" title="ログイン"
		horizontalScrollPolicy="off" verticalScrollPolicy="off"
		horizontalCenter="0" verticalCenter="0">
		<mx:Form id="loginForm" width="100%" height="100%">
			<mx:FormItem label="ログイン名:">
				<mx:TextInput/>
			</mx:FormItem>
			<mx:FormItem label="パスワード:">
				<mx:TextInput/>
			</mx:FormItem>
		</mx:Form>
		<mx:ControlBar>
			<mx:LinkButton id="registerLink" label="ログインIDがない?"
				click="currentState = 'register'"/>
			<mx:Spacer width="100%"/>
			<mx:Button id="loginButton" label="ログイン"/>
		</mx:ControlBar>
	</mx:Panel>
</mx:Application>