PDA

View Full Version : check back to see if statement is true


tiger
12-13-2002, 04:26 PM
I have the statement:

if (car._x>=294.0){
man._y=_y=30;
}

The problem is that if the statement is not true right away I wont get a result. The user is moving an object with the use of the keyboard. I want it so that if the statement becomes true then it occurs. So how do I make it keep checking back until it becomes true?

annexion
12-13-2002, 04:55 PM
Put the if statement in an onEnterFrame. That way it will check it with every frame iteration.

_root.onEnterFrame=function(){
//actions
}


You could put the above code in your main timeline...

Good luck.

tiger
12-13-2002, 05:10 PM
great works great thanks, one question though, does this mean every time the frame refreshes?

annexion
12-13-2002, 06:20 PM
Yep. The thing to realize is that on enterFrame works even if there is only one frame in the movie. So, it refreshes at the frame rate your specify.

Good luck.

tiger
12-13-2002, 06:36 PM
great thanks :)