반응형
statetest.xml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:states>
<mx:State name="state2">
<mx:RemoveChild target="{datechooser1}"/>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Text id="state2text" text="Text" width="105" horizontalCenter="24" verticalCenter="-10" textAlign="center"/>
</mx:AddChild>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Button label="go home" horizontalCenter="0" verticalCenter="18" id="bt_home" borderColor="#FFFFFF" click="currentState=''" fillAlphas="[1.0, 1.0]" fillColors="[#42FF00, #5AFF00, #BFEEA0, #E7FFCD]" themeColor="#FFFFFF"/>
</mx:AddChild>
<mx:AddChild relativeTo="{panel1}" position="lastChild">
<mx:Text x="49" y="89" text="오늘은"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.DateChooser;
function changed(event:Event):void{
var date:DateChooser = DateChooser(event.currentTarget);
var timeString:String = String(date.selectedDate.getFullYear())+"년";
timeString += " "+String(date.selectedDate.getMonth()+1)+"월";
timeString += " "+String(date.selectedDate.getDate())+"일";
currentState = "state2";
state2text.text = timeString;
//Alert.show(timeString);
}
]]>
</mx:Script>
<mx:Panel width="250" height="256" layout="absolute" horizontalCenter="0" verticalCenter="0" title="state test" id="panel1">
<mx:DateChooser horizontalCenter="0" verticalCenter="0" change="changed(event)" id="datechooser1"/>
</mx:Panel>
</mx:Application>
반응형