Go Near Flex Component Series (V): Data Components (dataehoose,datefiled) and text components (Label,text)
The date component Dataehoose in Flex is very simple, its function is to provide an intuitive date selection interface, more commonly used and need to remember is his change event.
1 <mx:DateChooser x="263" y="19" showToday="true"
2 change="displayDate(DateChooser(event.target).selectedDate)"/>
3 <mx:Label x="263" y="207" width="174" color="#6D05CE" id="lbDate"/>
The Datechooser component's Change event listens to the selected date changes and can be used to obtain the currently selected date data as follows:
1 private function displayDate(date:Date):void
2 {
3 if(date!=null)
4 {
5 this.lbDate.text=date.getFullYear().toString()+"年"
6 +(date.getMonth()+1).toString()+"月"
7 +date.getDate().toString();
8 }
9 }
In Flex there is another date component datefiled, he provides a text field to display the currently selected date data, this component usually applies the form and so on place, convenient and fast realizes the date entry function. The usage is basically consistent with the Datechooser component above, and its Change event, which is most commonly used, is defined as follows:
1 <mx:datefield x= "543" y= "change=" Datechange (Datefield (event.target). selectedDate) "/>
The Datechange method implements the display format of the date (default: Month/day/year), and so on, as shown in detail as follows:
1 private function dateChange(date:Date):void
2 {
3 if(date!=null)
4 {
5 this.df.text=date.getFullYear().toString()+"年"
6 +(date.getMonth()+1).toString()+"月"
7 +date.getDate().toString();
8 }
9 }
The effect is as shown in the following illustration:
Flex has 5 text components, respectively: Label,text,textarea,textinput,richtexteditor. About their use can be said in simple, here I just do not intend to introduce, these components in the html,asp.net development is ubiquitous, if you read this article you do not know the words, suggest you can change careers.
Source: http://beniao.cnblogs.com/