A summary of Flex program development experience

Source: Internet
Author: User
Tags relative

and Flash's development environment, Flex provides a component library is really tempting, but because the function is too comprehensive, resulting in large program size, sometimes improper use, may affect the efficiency of the program.

In the Flex Help manual, there is a special chapter on program optimization, and here are a few things I can do with help:

1, avoid the container of multi-level nesting, reduce relative size, relative positioning of the use.

The percentage is used to set the size of the components within the container, and once any one of the components in the container changes in position and size, it will cause the container to reposition all the children. If the nesting level is very deep, this calculation will be very large.

2. Use lightweight containers as much as possible

Canvas is the smallest container, and it only supports absolute positioning. Many times, you can use it instead of Hbox and VBox. In addition, canvas is also the first choice for us to write custom container-nature components. It has the basic function of the container, which facilitates the expansion.

3, avoid the use of large volume components, such as DataGrid, Advanceddatagrid

Large components are powerful, but expensive. Because of the complexity of the function, the realization of skin, style and itemrenderer is extremely complicated.

4, the processing of data more than the way to use pagination

When working with data type controls, minimize the amount of data displayed at once. For example Tilelist, it will create all the data at once, whether it is required to display, this is a waste of resources. Viewstack, Tabnavigator, etc. when processing a component, it is not created once, so that the unnecessary overhead is avoided as long as the component is created the first time it is displayed.

5, SetStyle and StyleName

The skin of the Flex component is a visual component that, when initialized by itself, uses the current style, such as stylename, to draw all skin components. If we modify the style of the component through SetStyle during run time, the size and position of the component will be adjusted accordingly. If the component is in a very deep container, there is also a large amount of computation.

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.