In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use objects for Flex data binding", 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 "how to use objects for Flex data binding" this article.
Using objects for Flex data binding
When working with an object, you have to consider when to define the binding to the object? Or consider when to define a binding to the properties of this object?
Bind to object
When making an object the source of an Flex data binding expression, Flex data binding occurs when the object is updated, or when the object's reference is updated, but not when a single (data) field (feild) of the object is updated.
In the following example, a subclass of the Object class is created with two properties, stringProp and intProp, but does not make them bindable:
PackagemyComponents {/ / binding/myComponents/NonBindableObject.as / / Makenoclasspropertiesbindable. PublicclassNonBindableObjectextendsObject {publicfunctionNonBindableObject () {super ();} publicvarstringProp:String= "Stringproperty"; publicvarintProp:int=52;}}
Because the two properties of this class are not bindable, Flex does not issue events to trigger Flex data binding when they are updated. Next, use this class in the Flex application, as shown in the following example:
Because the single data field (fields) of the NonBindableObject class is not made bindable, the bindings applied to the two Text controls are updated when the application starts and when the myObj is updated. When compiling the application, the compiler outputs a warning message that the Flex data binding mechanism cannot detect changes in the stringProp and intProp properties.
Bind to the properties of an object
To make the properties of the object bindable, create a new class definition, as shown in the following example:
PackagemyComponents {/ / binding/myComponents/BindableObject.as / / Makeallclasspropertiesbindable. [Bindable] publicclassBindableObjectextendsObject {publicfunctionBindableObject () {super ();} publicvarstringProp:String= "Stringproperty"; publicvarintProp:int=52;}}
By placing the [Bindable] metadata tag before the class definition, you can make all public variables in the class, as well as all public attributes that fully have setter and getter, bindable properties. You can then use the stringProp and intProp properties as the source for Flex data binding, as shown in the following example:
The above is all the content of the article "how to use objects for Flex data binding". 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!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.