Multiple Component Buttons Event Listener

I’m looking for a more compact way to write the following code sample - I have 10 different buttons and I’d like to write a different array to a Shared Object for each button (on click). The following code is for button 1:


bttnListener = new Object();
bttnListener.click = function(evt){
    var elemArrayOne:Array = new Array(p1, i1, e1, en1);
    //trace(evt.type + " triggered");
        Alert.show("Clicked");
//
//////WRITE FLASH COOKIE///////////////////////////////////
var elemSharedObject:SharedObject = SharedObject.getLocal("elementChoices", "/");
//
elemSharedObject.data.elemOne = elemArrayOne;
//
//Save the information in the Shared Object
elemSharedObject.flush();
//Status: Can data be written?
flushStatus = elemSharedObject.flush();
if (flushStatus == false) {
    Alert.show("Please check your Flash Player settings:");
    Alert.show("allow data to be saved to your computer as a cookie");
}
//Test data written to the Shared Object
_root.cookieValue = elemSharedObject.data.elemOne;
}
//Button listener
_root.table_mc.p1_bt.addEventListener("click", bttnListener);

Button 2 would need to declare “var elemArrayTwo:Array = new Array(p2, i2, e2, en2);”
That sort of thing. It seems really redundant to keep repeating all this code and create 10 different listeners. Is there a better way?