Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Flex binding Mechanism

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shares with you the content of a sample analysis of the Flex binding mechanism. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Flex binding mechanism

After we understand the event mechanism, it is not difficult to understand Flex binding. Flex binding is actually the application of the event mechanism.

1. What is Flex binding

The principle of Flex binding is events, which adds listening for change events on objects bound by Flex. Once a Flex bound object is changed, it will distribute a "propertyChange" event (default, it can also be changed to a self-defined event). In other components, there will be propertyChange event listening, and when the event is captured, it will update the properties of the component and display it.

The purpose of the Flex binding is to Flex the variables, classes, methods, and so on in the Flex to the values of the component. For example, if a variable is bound by Flex, the relevant properties of the component referencing the variable will also change. Let's use an example to show

The effect of the above program is that when you click button, button does not directly change the selected state of checkbox, but changes the variable isSelected, because isSelected is bound by Flex, then it will change the selected state of CheckBox.

This seems a bit superfluous, and you can change the selected property of checkbox directly. I'm just trying to demonstrate the effect. If you have hundreds of checkbox dynamically constructed, you are not going to change them one by one.

◆ therefore, most of us declare a data source with Flex binding, so that controls that reference the data source, such as datagrid, refresh the list data even if you don't reset the dataProvider when the data source changes. Of course, there are many applications waiting for you to try.

What happens if the declaration of [Bindable] is removed from this code? Won't isSelected change?

IsSelected will change, and the result of our alert will also show that the result has changed, but the selection status of checkbox will not change, because when a component is created and finally displayed, it goes through many methods, such as addChild,commitProperties,updateDisplayList, etc. UpdataDisplayList is similar to refreshing the display effect.

Just change the property without updating the display, and the component will not change as a result of the property change. The principle of Flex binding is also the use of event distribution, more complex Flex binding for you to discover.

Thank you for reading! This is the end of this article on "sample Analysis of Flex binding Mechanism". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report