I want to pass a parameter to the timer's timerEvent function.
Is it possible?
I know that in c++,I can use the function object,or just use the boost::bind. Is there something like boost::bind?
I want to pass a parameter to the timer's timerEvent function.
Is it possible?
I know that in c++,I can use the function object,or just use the boost::bind. Is there something like boost::bind?
you can also extend Timer class with your custom class, for example:
public class DataTimer extends Timer
{
private var _data:Object;
public function DataTimer(delay:Number, repeatCount:int=0)
{
super(delay, repeatCount);
_data = {};
}
public function get data():Object
{
return _data;
}
public function set data(value:Object):void
{
_data = value;
}
}
and use it in your callback function
var timerObj:DataTimer = event.currentTarget as DataTimer;
trace("data: "+timerObj.data);