Importing data and searching it

I am kinda new to Flash programming, and could use a little guidance. Here is the challenge: I am importing into Flash an XML file containing a price list, with the two key items being the item number and price. I want to then put a text field on the stage in which the user can enter the part number for which they are searching, and then, when a button on the stage is clicked, I want to show them a listing of the part(s) from that XML file that match the input along with the prices for those parts. This is for a stand-alone application that will be on a CD, not on the web.

I have been able to load the XML text, but triggering the load and a search from the stage has been problematic for me. Anyway, here’s what I have so far. This simply loads the file (that is shown below the code; the real XML file contains over 10,000 items), trims the part number down to the digits before the hyphen, and traces the results.

Any help/guidance would be most welcomed.

[COLOR=darkred]var xmlLoader:URLLoader = new URLLoader(); [/COLOR]
[COLOR=darkred]var xmlData:XML = new XML(); [/COLOR]

[COLOR=darkred]xmlLoader.addEventListener(Event.COMPLETE, LoadXML); [/COLOR]

[COLOR=darkred]xmlLoader.load(new URLRequest(“test.xml”)); [/COLOR]

[COLOR=darkred]function LoadXML(e:Event):void { [/COLOR]
[COLOR=darkred]xmlData = new XML(e.target.data); [/COLOR]
[COLOR=darkred]ParseBooks(xmlData); [/COLOR]
[COLOR=darkred]} [/COLOR]

[COLOR=darkred]function ParseBooks(bookInput:XML):void { [/COLOR]
[COLOR=darkred]trace(“XML Output”); [/COLOR]
[COLOR=darkred]trace("------------------------"); [/COLOR]

[COLOR=darkred]var prodList:XMLList = bookInput.item; [/COLOR]

[COLOR=darkred]for (var i:int = 0; i < prodList.length(); i++) { [/COLOR]
[COLOR=darkred]var prodItem = bookInput.item.prod.text();[/COLOR]
[COLOR=darkred]var priceItem = bookInput.item.price.text()
;[/COLOR]
[COLOR=darkred]var hyphenPos = prodItem.indexOf("-");[/COLOR]
[COLOR=darkred]var finalProd = prodItem.slice(0,hyphenPos);[/COLOR]

[COLOR=darkred]trace(finalProd);[/COLOR]
[COLOR=darkred]trace(priceItem);[/COLOR]
[COLOR=darkred]} [/COLOR]
[COLOR=darkred]} [/COLOR]

The XML File:

[COLOR=seagreen]<?xml version=“1.0” encoding=“utf-8”?>[/COLOR]
[COLOR=seagreen]<prodlist>[/COLOR]
[COLOR=seagreen]<item>[/COLOR]
[COLOR=seagreen]<id>1001121</id>[/COLOR]
[COLOR=seagreen]<prod>7558-02</prod>[/COLOR]
[COLOR=seagreen]<um></um>[/COLOR]
[COLOR=seagreen]<price>10.56</price>[/COLOR]
[COLOR=seagreen]<index>Y</index>[/COLOR]
[COLOR=seagreen]</item>[/COLOR]
[COLOR=seagreen]<item>[/COLOR]
[COLOR=seagreen]<id>1001181</id>[/COLOR]
[COLOR=seagreen]<prod>7557-02</prod>[/COLOR]
[COLOR=seagreen]<um></um>[/COLOR]
[COLOR=seagreen]<price>18.49</price>[/COLOR]
[COLOR=seagreen]<index>Y</index>[/COLOR]
[COLOR=seagreen]</item>[/COLOR]
[COLOR=seagreen]<item>[/COLOR]
[COLOR=seagreen]<id>1001191</id>[/COLOR]
[COLOR=seagreen]<prod>7557-04</prod>[/COLOR]
[COLOR=seagreen]<um></um>[/COLOR]
[COLOR=seagreen]<price>20.69</price>[/COLOR]
[COLOR=seagreen]<index>Y</index>[/COLOR]
[COLOR=seagreen]</item>[/COLOR]
[COLOR=seagreen]</prodlist>[/COLOR]