Hey guys, I am posting this because I am having a ton of trouble with a script of mine. First of all, here is the code:

moveMe = function () {
	this.targx = Math.round(Math.random() * 550);
	this.dx = (this.targx - this._x)*.01;
	this._x += this.dx;
moveline.onEnterFrame = moveMe;

What I want to have happen is to use setInterval and have it wait for, say 2 seconds. However, when I use this, it doesn’t work at all.

setInterval = (moveMe, 2000);

I have tried many ways of writing this and putting it in different places, but still nothing. Could it be because I am using the onEnterFrame to execute the function?

I have looked around the forums for a long time to try to solve my problem, but I can’t find how to get setInterval to work with my script.

Thanks guys!

Are you trying to pause your timeline for x number of seconds? Or just a specific object?

Just the specific script. Right now, the ocject will randomly move, however it doesn’t reach its destination. It just wobbles back and forth because there isn’t any time to move before it picks a new random number and destination. I want to give it about two seconds to travel along before we repick the destination.


This doesn’t fix the problem, but I can see one error…

Set Interval looks like this…

setInterval(moveMe, 2000)

Yeah that’s what I had, I just wrote it wrong in the forum.


This is what I have so far

moveMe = function () {
	this.targx = Math.round(Math.random()*550);
	// trace(this.targx);
	this.dx = (this.targx-this._x)*.01;
	this._x += this.dx;
setInterval(function () {
	trace("2 seconds passed");
	moveline.onEnterFrame = moveMe;
}, 2000);

This first delays your clip 2 seconds, but then after that it does what it does in the first place. Getting there though.

Not sure how long I can work on this, but I will be for a little while.

Your footer crashes my Netscape 7… :evil:

Fine on IE 6… =)

Are you using something different than just an swf? Not that it matters much, I’m just curious… :-\

Yours is the only one which crashes N7… :q:


Is it his?..or mine???

Mine uses .png images which can be known to take up system resources if you use to many in motion.

I haven’t had any complaints about it though.

:::opening netscape 7:::

I will let you know if anything happens on my side rev

EDIT/UPDATE: Works perfectly fine in my NS7 rev.

Hmmm Reverend, sorry about that. It is just a .swf though. When I have more itme I will change it.


No, no need to change… I use IE a lot as well… =)

I was just curious why yours didn’t work as well as anybody else’s (only seems to happen when you post, for some odd reason)… :q:

I’m still trying to decide whether I like N7… and I’m leaning against, just becuase of quirks like this… :-\

Could be my lame-ass 'puter (still using a 450Mhz Frankenstein looking piece o’crap)… especially since Lostinbeta’s N7 works…

Maybe my N7 doesn’t like you… :stuck_out_tongue: jk (prob jealous)

Thanks guys, for responding, =)

Oh, and GO GIANTS!!!


Yeah I just finished watching the game. Dominant force! Hey, it seems this thread has gotten off track though a little, can anyone help me with my setInterval problem?


sorry, back to your regularly scheduled programming… :cool:

:::goes and sits in corner…again:::


Well, doesn’t Lost’s code work?

OMG guys I’m sorry. ****it I’m way too tired. I have been periodically checking back to see if someone had replied when Lost had awhile back and I had somehow looked over his post! Then I asked if we could get the thread back on track…wow. I have got to get some sleep. See you all in the morning.


:stuck_out_tongue: :stuck_out_tongue:

OK last post for the night, I swear!

You are right Lost, the clip is delayed for 2 seconds, and then it does the random motion that it usually does. I don’t really care about the delay in the beginning, if possible that shouldn’t do that. It should pick the destination, wait 2 seconds, and then repick another destination. (over and over again in this loop) I will work more on it tomorrow. Let me know if you find anything.