Go Near Flex Component Series (V): Data Components (dataehoose,datefiled) and text components

Source: Internet
Author: User
Tags getdate

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/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.