Flex 3 learning summary 2

Source: Internet
Author: User

1. Data Binding
<Mx: panel Title = "simple data binding" fontsize = "13" x = "225" Y = "180" Height = "138" width = "213" verticalalalign = "Middle"

Horizontalalign = "center">
<Mx: vbox>
<Mx: hslider id = "myslider"/>
<Mx: Text text = "{myslider. Value}"/>
</MX: vbox>
</MX: Panel>
Pull {}

2 model binding
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute" fontsize = "13">
<Mx: Model id = "employeemodel">
<Employees>
<Employee>
<Name> john smith </Name>
<Department> Technical Department </Department>
<Email> john@163.com </Email>
</Employee>
<Employee>
<Name> Tom Steve </Name>
<Department> Human Resources Department </Department>
<Email> tom@163.com </Email>
</Employee>
</Employees>
</MX: Model>
<Mx: panel title = "using model components">
<Mx: DataGrid dataprovider = "{employeemodel. Employee}">
<Mx: columns>
<Mx: datagridcolumn datafield = "name" headertext = "employee name"/>
<Mx: datagridcolumn datafield = "department" headertext = "department"/>
<Mx: datagridcolumn datafield = "email" headertext = "email"/>
</MX: columns>
</MX: DataGrid>
</MX: Panel>
</MX: Application>

3. Use mx: object to bind
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute">
<Mx: panel title = "using object components">
<Mx: DataGrid>
<Mx: dataprovider>
<Mx: Object Name = "John Smith" department = "Technology Department" email = "john@163.com"/>
<Mx: Object Name = "Tom Steve" department = "Human Resources Department" email = "tom@163.com"/>
<Mx: Object Name = "Fisher Steve" department = "Human Resources Department" email = "fisher@163.com"/>
</MX: dataprovider>
</MX: DataGrid>
</MX: Panel>
</MX: Application>
4. Tree list component
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml"
Fontfamily = "simsun" fontsize = "12"
Layout = "absolute" width = "242" Height = "442">
<Mx: panel title = "using XML components">
<Mx: tree id = "Tree" x = "10" Y = "35" width = "218" Height = "397" showroot = "false" labelfield = "@ label">
<Mx: dataprovider>
<Mx: XML id = "xmldata">
<Menus>
<Node label = "mail">
<Node label = "inbox"/>
<Node label = "personal folder">
<Node label = "Demo"/>
<Node label = "personal"/>
<Node label = "saved mail"/>
<Node label = "bar"/>
</Node>
<Node label = "calendar"/>
<Node label = "sent"/>
<Node label = "trash"/>
</Node>
</Menus>
</MX: XML>
</MX: dataprovider>
</MX: Tree>
</MX: Panel>
</MX: Application>
5. Verification
<Mx: numbervalidator id = "numv" Source = "{txtqq}" property = "text"/>
<Mx: Label x = "19" Y = "274" text = "QQ"/>
If & numv. Validate (). type = validationresultevent. Valid
{

... // verification passed
}< br> stringutil. trim (txtpassword. text) = "", where stringutil. trim is used to remove spaces
6 date formatting


[Bindable]
private var today: Date = new date (); // obtain the system time, stored in the date type
]>


formatstring = "Mmmm D, YYYY"/>

Verticalalign = "Middle">
<Mx: Label text = "unformatted Date: {today}"/>
<Mx: Label text = "formatted Date: {datedisplay. Format (today)}"/>
</MX: Panel>
</MX: Application>


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.