See http://www.k-zone.cn/zblog/post/adobe-flex-air-traing-diagrams-data-2.html for details
The original text is as follows:
The previous article Adobe Flex/air learning route (data in flex Part 1) analyzes some frequently used data types in flex and some frequently used classes for data processing, today, we will briefly describe which components in flex also have data processing capabilities.
1. The definition of dataprovider in Adobe ActionScript 3.0 is as follows:The dataset to view. This attribute allows you to use most types of objects as data providers. If you set the dataprovider attribute to array, it is converted to arraycollection. If you set this attribute to an XML object, it is converted to the xmllistcollection that contains only one project. If this attribute is set to xmllist, it is converted to xmllistcollection. If you set this attribute to an object that implements the ilist or icollectionview interface, you can directly apply this object. Affected by the conversion operation, when you obtain the dataprovider attribute, this attribute value is always icollectionview, so this value is not necessarily the object type you set. If you want to modify the data in the data provider, it is important to understand the following actions: changes to the original data may not be detected, however, changes to the icollectionview object obtained from the dataprovider attribute are detected. The default value is null. This attribute can be used as the source for data binding.A. All components with dataprovider can use array, XML, and other content as data sources. B. Bind the content as the data source automatically and display it on these controls. Therefore, after obtaining external data, flex can assign it to dataprovider directly, and then display data on these components through some settings. On this example I will not repeat here, you can find it, or directly look at the content here: http://livedocs.adobe.com/flex/3_cn/mx/controls/ComboBox.html#includeExamplesSummary
2. itemrenderer (Project Renderer) and its data attributes.
Itemrenderer is used to customize the project display effects of some components. For example, the well-known ComboBox, list, and DataGrid all have such attributes. That is to say, we can use itemrenderer to improve the pull-down Display Effect in ComboBox. Of course, this is also true for list and DataGrid. After a custom Renderer is defined in ComboBox and dataprovider is used to bind a data source, how can this function work with items in our custom Renderer? Data is used. That is to say, dataprovider can bind data to the UI. If this component uses a custom Renderer, you can use data. xxx to obtain data in dataprovider. Okay: the above two knowledge points are about the data processing capabilities of the Flex component. dataprovider can bind array, XML, and other content as data sources and display them on the UI, the data in itemrenderer is the data processing between the component and its Renderer. The next article describes several common methods for communication between flex and the background: httpservice, WebService, remote, and so on, with these methods, you can easily enable mainstream programming languages such as Java, C #, Python, Ruby, and PHP to serve Flex. Add: the specific usage of dataprovider, itemrenderer, and data is somewhat abstract. Therefore, I would like to list an example to illustrate. This is a horizontallist component, and its itemrenderer = toolboxrenderer. Let's take a look at the snippet code of horizontallist <mx: horizontallist id = "myhorizontallist" itemrenderer = "toolboxrenderer" itemclick = "toolpic_onclick (event)"> <mx: dataprovider> <mx: array> <mx: object tooltip = "rubber" stylename = "rubber" Language = "{_ language}"/> </MX: array> </MX: dataprovider> </MX: horizontallist> the code snippet of toolboxrenderer: <mx: canvas width = "30" Height = "30 "> <Mx: button width =" 30 "Height =" 30 "tooltip =" {data. tooltip} "stylename =" {data. stylename} "/> </MX: canvas> let's see how itemrenderer associates with our topic today. 1. Define a dataprovider in myhorizontallist. The Code shows that it is an array-type variable and assigns it to dataprovider. In this case, the data should be displayed on myhorizontallist, which is the use of dataprovider. 2. Define the following structure in the array contained in dataprovider:
<Mx: Object tooltip = "rubber" stylename = "rubber" Language = "{_ language}"/>2. We not only set dataprovider, but also set itemrenderer, that is, toolboxrenderer. 3. In toolboxrenderer, a button is defined, and data in dataprovider can be obtained in a similar way: tooltip = "{data. tooltip} "The above is a very simple, but very typical usage of dataprovider, itemrenderer, and data. I hope you can understand it :)