Event listeners into arrays/loops help!

I have been working on this for about 2 hrs, Im trying to think of a way to compress all the code I have so far into about 3 loops/arrays.

I have 20 instances of the same button that will be added to the stage, call it car_btn. Then I have an xml file where Im grabbing the nodes using an index number ex: [3]. Then I have 20 instances of the same popup_mc, all of the buttons pull data from an xml file and populate this popup_mc.

here is my code, anyone know how to simplify all of this into a series of arrays/loops. I want to make it so its not adding just one instance of the popInfo - but one for each button that is clicked.



// variables
var popInfo:popMc;


// load xml
var xml:XML = new XML();
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("data/cities.xml"));
loader.addEventListener(Event.COMPLETE,
    function(evt:Event):void {
        xml = XML(evt.target.data);
        //trace(xml.city[0][email protected]());
        var url:URLRequest = new URLRequest(xml.city[0][email protected]()); 

    }
);

 

// event listeners
seattleBtn.addEventListener(MouseEvent.CLICK, onClickLoadData);
losangelesBtn.addEventListener(MouseEvent.CLICK, onClickLoadData);
stage.addEventListener(MouseEvent.CLICK, onClickStageRemove);

// functions
function onClickLoadData(event:MouseEvent):void
{
    if(event.target == seattleBtn)
    {
    popInfo = new popMc();
    popInfo.x = 130;
    popInfo.y = 50;
    addChild(popInfo);    
    popInfo.closeBtn.addEventListener(MouseEvent.CLICK , onClickRemove);
    popInfo.nyopBtn.addEventListener(MouseEvent.CLICK, onClickNYOP);
    popInfo.carsizeText.text = xml.city[1].bidlist.carsize.descendants().toXMLString();
    popInfo.priceText.text = xml.city[1].bidlist.price.descendants().toXMLString();
    popInfo.savingsText.text = xml.city[1].bidlist.savings.descendants().toXMLString();
    popInfo.stateText.text = xml.city[1][email protected]();    
    }
    else if(event.target == losangelesBtn)
    {
    popInfo = new popMc();
    popInfo.x = 100;
    popInfo.y = 50;
    addChild(popInfo);    
    popInfo.closeBtn.addEventListener(MouseEvent.CLICK , onClickRemove);
    popInfo.nyopBtn.addEventListener(MouseEvent.CLICK, onClickNYOP);
    popInfo.carsizeText.text = xml.city[2].bidlist.carsize.descendants().toXMLString();
    popInfo.priceText.text = xml.city[2].bidlist.price.descendants().toXMLString();
    popInfo.savingsText.text = xml.city[2].bidlist.savings.descendants().toXMLString();
    popInfo.stateText.text = xml.city[2][email protected]();    
    }
}

    
function onClickRemove(event:MouseEvent):void
{
    removeChild(popInfo);
}

function onClickStageRemove(event:MouseEvent):void
{
    if(event.eventPhase == EventPhase.AT_TARGET) {
        removeChild(popInfo);
    }
}

function onClickNYOP(event:MouseEvent):void 
{
    //navigateToURL(url, "_blank");
    // navigateToURL(urlNY, "_blank"); //trying to get this variable to work
    ExternalInterface.call("selectNY");

}

// set button mode here
seattleBtn.buttonMode = true;
losangelesBtn.buttonMode = true;