Invoking a cycle in a function without rewriting it?

hello,
i’m stuck with this problem: i have a for loop running through an array:


for (var e:int = 0; e < coo.length; e++) {
    coo[e].addEventListener(MouseEvent.ROLL_OVER, evidenzia);
    coo[e].addEventListener(MouseEvent.CLICK, evidenzia_fisso);
    coo[e].alpha = 0.4;
    }

but when i have to call back the cycle inside a function, it gives me error 1090 unless i repeat the cycle inside the function:


function evidenzia_fisso(event:MouseEvent):void {
    for (var e:int = 0; e < coo.length; e++) {
    coo[e].removeEventListener(MouseEvent.ROLL_OVER, evidenzia);
    coo[e].removeEventListener(MouseEvent.ROLL_OUT, n_evidenzia);
    coo[e].removeEventListener(MouseEvent.CLICK, evidenzia_fisso);
    for (var i:int = 0; i < quiqua.length; i++) {
        if     (quiqua*.saturaz != event.currentTarget.saturaz){
              quiqua*.alpha = 0.2;
               }
    coo[e].addEventListener(MouseEvent.CLICK, per_ogni_click, false,0,true);
    stage.addEventListener(MouseEvent.CLICK,reset,false,0,true);
        }
    }

i’m recalling this cycle in a lot of functions so it’s kinda boring and confusing repeating it every time.

i tried assigning a variable to the elements:

var coo_att:MovieClip = MovieClip (coo[e]);

but it doesn’t work properly.

I really don’t know what to do.