PDA

View Full Version : Timer, adding function parameters



sumo
July 19th, 2007, 07:46 AM
Hi.

Is there any way to add parameters for a function that I'm calling with Timer?

Normally I would this:
ActionScript Code:

createBalls(5);
function createBalls(num:int):void
{
//some code based on num
}




With Timer:
ActionScript Code:

var myTimer:Timer = new Timer(1000, 1);
myTimer.addEventListener(TimerEvent.TIMER, createBalls);
myTimer.start();




Where to put the parameter for that function in the Timer? Is it even possible?

kiosk77
July 19th, 2007, 09:11 AM
I couldn't see anything in the docs about Timer being to take in any arguments

Why not use setTimeout or setInterval? they both take arguments