Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the Flex data binding traps?

Shulou Source: shulou.com Published: 2022-06-02 07:59:22 10月03日 Update

This article mainly shows you "what are the Flex data binding traps", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the Flex data binding traps" this article.

Flex data binding Trap

◆ Usingbindinginplaceofdirectassignment uses bindings where values are assigned directly

In one case, if you can successfully achieve the same effect without using binding and using direct assignment, you * do not use binding. I have seen many forms of this type of error.

The following code illustrates:

This code defines a text input box that binds private member variables to the text property of the text input box. It looks harmless, doesn't it? I often see these types of tags used in Flex applications. Flex's compiler automatically generates code to implement Flex data binding.

You will find that although you do not need to bind the text string because it is assigned once, the compiler still generates code to accommodate the conditions of the property Flex data binding. In addition, there are cases where you need to unbind after assignment, or remove the binding code to reduce overhead, but you will not be able to do so after using tags in MXML.

As a rule of thumb, you should avoid binding to a private variable.

In the above example, you can set the value directly to the input text box.

When you use direct assignment, you will greatly reduce your overhead because the compiler will no longer generate binding code that you do not need. As a general rule of thumb, do not use Flex data binding unless the value of your binding may or will definitely change.

These are all the contents of the article "what are the Flex data binding traps?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data code traps content text articles compilers generation compilation input variables attributes overhead situations tags rules types experience facets learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info Linux MariaDB vpn