Loops and movieclip references

Hey,

I am sure I’ve done this before and it worked, not sure what I am not doing right.

I am creating 2 movieclips dynamically in a loop and attach a rollover event to one of them to manipulate the other one. Looks like this:


for(var i=0; i<5; i++){
    var clip1 = this.createEmptyMovieClip("cheese"+i, this.getNextHighestDepth());
    var clip2 = this.createEmptyMovieClip("burger"+i, this.getNextHighestDepth());
    
    clip2.onRollOver = function(){
        // do something with clip1, for example:
        clip1._visible = false;
    }
}

What happens is that when I roll over any of the clip2 movieclips they all modify the same clip1 movieclip, not the one that was created in the same loop cycle.

Any ideas?

G