AS help needed
- Started
- Last post
- 11 Responses
- Luckypp
Hey all, I have an old flash4 script that I need to update to work in MX, it is part of a timer script, here is the old code,
if (Number(/:Delay) == Number("")) {
/:Delay = 5;
}
/:Elapsed = 0;
Start = getTimer();
gotoAndStop("BeginUp");Can anyone update it with the new syntax?
- enjine0
this shouldn't even work in flash 4,and i'll bet it doesn't. you're first line of code compares a numeric variable to a number-casted empty string... which always evaluates to undefined.
- Luckypp0
It's not the full code, and it does work like a dream in flash 4, I was just posting this section of it to learn how to change the syntax.
Any links to good timer scripts? Check kirupa.com and found nada, going to actionscript.org right now.
- SirG0
What kind of timer do you need?
- Luckypp0
Just a simple timer that counts down and when it reaches zero it runs a command.
Such as after 3 seconds, it goes to the next frame.
No need to display anything, just have it count down and then play a function.
- quoo0
um, setInterval?
- SirG0
um, setInterval?
quoo
(Oct 4 05, 07:48)Exactly.
- Luckypp0
Can you point me to a tutorial?
Good to know that setInteral is the way to go, but can I have a bit more help?
- SirG0
- enjine0
function timer(){
trace("bang!");
clearInterval(timerID);
}
var timerID = setInterval(this, "timer", 3000);
- Luckypp0
thanks!
- Luckypp0
PERFECT! Does exactly what I need, thanks a million!