well, i keep trying to do stuff that i’ve never done with my portfolio so i keep running into more and more problems. basically i need to know how to write code for the following:
i have a button on in a movie clip, and when i press it, i want there to be a two second timer and when two seconds is up, load a movie into a movieclip on my main timeline.
i have searched this site and actionscript.org for such scripts, and actually found one on actionscript.org but couldnt get it to work. any help would be greatly appreciated. thanks in advance.
edit: this is the tutorial i tried that didn’t work for me, not sure if my edit of the code was wrong or what:
Sure…
The first statement is just a function declaration:
function delayMe() {
var sTime = _root.sTime
var curTime = getTimer()/1000;
if (curTime-sTime>2) {
clearInterval(_root.delayInterval);
// XXX
}
}
</FONT>
It set’s up the function which will be called each time to see if the amount of time we want has passed or not…
If it has, it clears the interval.
What is an interval?
An interval is a function which calls another function every X mili-seconds (1 second = 1000ms).
In the button’s onRelease state we define that interval, and tell it to call the function delayMe every 100ms.
The rest is pretty much self-explanitory, but let me know if you need more elaboration on anything.