Forum Moderators: open
Im wanting to be able to call it like so:
timer (time, action);
where time is the milliseconds to time, and action is what to do when the times up; e.g.
timer (5000, '_root.mcInstance.play();');
however, i dont how to get the function to do the:
_root.mcInstance.play();
bit.
I thought just putting action; in the approriate place would do it.
Ive tried all sorts of things but to no avail.
Any pointers? :(
I split the action i wanted to take up into the path and what i wanted it to do:
//#### TIMER FUNCTION
timer = function (time, path, action) {
current = getTimer();
onEnterFrame = function () {
now = getTimer();
comp = (current)+time;
if (comp<=now) {
_root[path][action]();
delete this.onEnterFrame;
}
};
};
and called it like this:
_root.timer(5000, "instancename", "play")
if i need to do anything more complex than stop or play afterwards, i will could the action in another mc and use the play() to access that.