# Looping a function endlessly

**URL:** <https://forum.kirupa.com/t/looping-a-function-endlessly/319113>\
**Category:** Uncategorized\
**Created:** [February 9, 2011, 10:02am UTC](https://forum.kirupa.com/t/looping-a-function-endlessly/319113 "2011-02-09T10:02:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrzdzn](https://avatars.discourse-cdn.com/v4/letter/w/73ab20/32.png) [@wrzdzn](https://forum.kirupa.com/u/wrzdzn)\
**Post date:** [February 9, 2011, 10:02am UTC](https://forum.kirupa.com/t/looping-a-function-endlessly/319113/1 "2011-02-09T10:02:12Z")

</div>

How can I keep repeating my functions below endlessly?  
I am Using the enterframe and timer class.  
I want my object to keep going across the stage over and over.  
Do I need a **for**  **loop**?Any help would be great, thanks.

**Timer Class**  
var myTimer:Timer=new Timer(10,10000);  
myTimer.start();  
myTimer.addEventListener(TimerEvent.TIMER, moveMan);  
function moveMan(myevent:TimerEvent):void{  
car\_mc.y-=2

}  
**Enter frame**

man\_mc.addEventListener(Event.ENTER\_FRAME, moveman);  
function moveman(myevent:Event):void {  
man\_mc.y-=5;  
if (man\_mc.y\<-400) {  
man\_mc.removeEventListener(Event.ENTER\_FRAME, moveman);  
}  
}
