PDA

View Full Version : Help with if statement



jusjay
January 21st, 2002, 03:57 PM
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.
Thanks!

eyezberg
January 21st, 2002, 04:02 PM
you must use double = , as in (status==2), else you're not checking status, but setting it to 2!
simple as that :)

liveacoustic
January 21st, 2002, 04:03 PM
... 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?

eyezberg
January 21st, 2002, 04:08 PM
Nope, "if (status = 2)" will set status to 2 every time the if statement is entered!

jusjay
January 21st, 2002, 04:13 PM
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);
}

jusjay
January 21st, 2002, 04:16 PM
If you are wondering what I am working on here ya go.

I call it my virtual Escalator.

www.jaycook.net/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.

liveacoustic
January 21st, 2002, 04:18 PM
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.

eyezberg
January 21st, 2002, 05:34 PM
Ohhh..so you're insulting me? P'tit con va!

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

liveacoustic
January 21st, 2002, 06:29 PM
Likewise, of course.