for(var i:Number = 0; i<5; i++){ but = this["b"+i]; but.id = i; but.onRollOver = function(){ this._parent["mc"+this.id].play(); } }