Most binding examples work with a flat XML structure. However, in most cases the format of the data will not work directly with Flex components. I was looking for a way to bind complex XML to a DataGrid in Flex 2. I ran across a post by Brandon Purcell dealing with the same subject but his post was a little out of date and no longer worked in Flex 2. There was also some talk on Flash Coders about complex XML and using the labelFunction to bind it to the DataGrid, but I could not find a complete example. So I created a working example using the similar data.
I ran into some difficulty at first when I placed the labelFunction inside the DataGridColumn. If you don’t pass column:DataGridColumn to the myLabelFunc, the DataGrid will not show up. You can view the example here, right-click to view the source code. For a detailed discussion, please visit Brandon’s original post.