Parse through XML document

Okay, so I have two swf files. A homepage and a sub page. I have a list of elements to select from on the home page:


Jims Profile
Freds Profile
Bobs Profile

When you select say ‘Freds Profile’, I would like to load my subpage.swf which displays 'Freds" profile information.

So here’s my delima. I don’t know how to parse through my xml sheet to retrieve only "Freds Profile’, and I don’t know how to pass that parameter to subpage.swf so it knows to initialize only “Freds” profile information.

If I was building this page in php and retrieving data from a database, I know how I would do it with query strings, but this sort of thing in flash is new to me.

Here is my XML file for reference:


<profileText>
 <channel>
   <code>jim</code>
   <name>Jim's Profile</name>
   <address>Jim's Address 1</address>
   <desc>Jim's Description</desc>
 </channel>
 <channel>
   <code>fred</code>
   <name>Fred's Profile</name>
   <address>Fred's Address 1</address>
   <desc>Fred's Description</desc>
 </channel>
 <channel>
   <code>bob</code>
   <name>Bob's Profile</name>
   <address>Bob's Address 1</address>
   <desc>Bob's Description</desc>
 </channel>
</profileText>

I just want to query my xml file by the code name of the profile. So if I wanted to find Fred…I would query “?code=fred”. How do I do this sort of thing with XML and flash?