Dispaly clickable buttons based on number of similar nodes in an XML file?

I have a flash gallery (that works ok as it is) however I’d like to upgrade it a bit and I’m stumped.

Right now there is a single image for each portfolio item pulled from an XML file. Some portfolio items however have more than 1 image. Some have 2 and a few have up to 4 or 5.

How can flash automatically see how many similar nodes there are within a set and then display a clickable “1, 2, 3, etc” button below the image to view each photo or if there is only 1 photo, no numbers will appear at all?

Thanks!
Neil

They will use a format similar as shown below. Notice how the first one only has 1 image and the second has 3 image nodes.


<images>
    <pic>
	<image>images/web/dictaphone.jpg</image>
	<description>Description: Working with the Dictaphone marketing department worked on a complete overhaul of the entire Dictaphone website.</description>
	<thumbnail>images/web/dictaphone_s.jpg</thumbnail>
	<sectitle>Web</sectitle>
	<client>Client: Dictaphone Corporation</client>
	<project>Project: Company Website</project>
    </pic>
    <pic>
        <image>images/web/upstart1.jpg</image>
        <image>images/web/upstart2.jpg</image>
        <image>images/web/upstart3.jpg</image>
        <description>Description: Creation of the new Upstart Training website and formulation of entirely new corporate branding.</description>
        <thumbnail>images/web/upstart_s.jpg</thumbnail>
	<sectitle>Web</sectitle>
	<client>Client: Upstart Training</client>
	<project>Project: Website</project>
    </pic>
</images>