for (var i = 0; i<6; i++) { var mc = this.attachMovie("gbutton", "gbutton"+i, i+1); mc._y=i*20; mc.onRelease = function() { trace(this); }; }