Help with if statement

I am using the following if statement but each time the statement is called it changes the variable “status” to 2 regardless. If the status is 1 going into the frame that contains this statement it is changed to 2.

if (status = 2) {
&nbsp &nbsp &nbsp &nbsp _root.step.gotoAndStop(630);
&nbsp &nbsp &nbsp &nbsp _root.step.back.gotoAndPlay(“loop”);
} else {
&nbsp &nbsp &nbsp &nbsp gotoAndPlay(2);

Any help is appreciated.

you must use double = , as in (status==2), else you’re not checking status, but setting it to 2!
simple as that :slight_smile:

… but it seems to me that the problem happened when you declared what the variable was equal to.

Can I see the script for that part?

Nope, “if (status = 2)” will set status to 2 every time the if statement is entered!

That did the trick!! thanks!!
Here is the correctd script.

if (status == 2) {
&nbsp &nbsp &nbsp &nbsp _root.step.gotoAndPlay(630);
&nbsp &nbsp &nbsp &nbsp _root.step.back.gotoAndPlay(“loop”);
} else {
&nbsp &nbsp &nbsp &nbsp gotoAndPlay(2);

If you are wondering what I am working on here ya go.

I call it my virtual Escalator.

I am an engineer for an escalator company. I am trying to get the escalator to run up and down. Well thanks to your help it will.

Pfft. You think you’re so great just because you noticed there was only one equals sign.

… Jerk.

… Maudit…

… Hey, I never noticed before that the french word for “Dammit” is “Bad Word”! (Well, “Bad Say”, to translate litteraly.) Heh. How clever.

Ohhh…so you’re insulting me? P’tit con va!

:slight_smile: I hope you’ll understand i’m only joking, was grinning when writing this, jus’ a lil’ fun, okiedokie?

Likewise, of course.