for (i=0; i<20; i++) { _root["butt"+i].id = i; _root["butt"+i].onPress = function() { trace(this.id); }; }