loop a function

hi all i want to be able to loop a normal function that i create and dont know the proper way of doing this.

would it be a simple loop function to do this, can someone please give me an example of the correct way of doing it, prefably by time

while(iWannaLoopMyFunctionEveryFrame)
{
MyFunction();
yield;
}

or

function LoopMyFunctionXTimesInTheSameFrame(nbOfLoops:int)
{
   for(var i:int=0;i<nbOfLoops;i++)
   {
       MyFunction();
   }
}

or

function LoopMyFunctionXTimesEveryYFrames(nbOfLoops:int,frameInterval:int)
{
   for(var i:int=0;i<nbOfLoops;i++)
   {
       MyFunction();
       for(var j:int=0;j<frameInterval;i++)
       {
            yield;
       }
   }
}

Ah!

What you need is InvokeRepeating!

Simply write InvokeRepeating(“myFunction”,0,timeIntervalInSeconds);

But not in the Update() function!