function myfunk(){ ob._y=random(180); this.onEnterFrame = function(){ ob._y+=10; if (ob._y>220){ delete this.onEnterFrame; myfunk(); } } } myfunk();