I'm having problems with this xml example. What I'm trying to do is create an XML file with information on at least 20 pictures, organized in four or five categories. Each category needs to have a name associated with it, and each picture needs a name, width, height, description, and filename for thumbnail. I also need to add a Tree control to the application that will display the categories, and when these are opened, the name of the pictures. Selecting the name of a picture in the Tree needs to display all the information about the picture, including a thumbnail of the picture.
I considered using XMLListCollection to get the data from the XML file to the Tree control. In the Tree control, I need to use the change event to assign the values of the Label components and the Image component related to the selected picture. Basically I need to modify the attached flex project to make this happen
<fx:Declarations>
<fx:XML id="emails" source="emails.xml"/>
</fx:Declarations>
<s:VGroup width="400">
<mx:Tree id="tree" width="400" labelField="@label"
change="
{
if(tree.selectedItem.hasOwnProperty('@from')) {
from_field.text = tree.selectedItem.@from;
date_field.text = tree.selectedItem.@date;
picture.source = tree.selectedItem.@filename;
}
}
"
>
<mx:XMLListCollection id="messageColl"/>
</mx:Tree>
</s:VGroup>
<s:VGroup>
<s:Label text="from"/>
<s:Label text="date"/>
</s:VGroup>
<s:VGroup>
<s:Label id="from_field"/>
<s:Label id="date_field"/>
<mx:Image id="picture"/>
</s:VGroup>