How do i continually check for elapsed time?

Hi all,
Im trying to tell a movie clip (placed on the main timeline) to goto the next frame when a certain interval of time has lapsed. And when a further amount of time has lapsed I want it to tell the movie clip to go the next frame.
Can someone please help me do this.
So far I’ve got this:


stop();
var so:SharedObject = SharedObject.getLocal("user");
if (so.size == 0)
{
    // Shared object doesn't exist.
 trace("created...");
    so.data.now = new Date().time;
}
var ageMS:Number = new Date().time - so.data.now;
trace("SharedObject was created " + Number(ageMS / 1000 / 60).toPrecision(2) + " minutes ago");
trace("SharedObject is " + so.size + " bytes");
so.flush();
if (ageMS / 1000>5){
 this.P.gotoAndStop(1);
 // this.P.nextFrame();
}
else
if (ageMS / 1000>10){
 this.P.gotoAndStop(2);
 // this.P.nextFrame();
}

Where P is the movie im tryig to manupulate.
But it doest work. :frowning:
Please help.
Regards
Q