Skip to main content
tropicanaclock
Known Participant
May 3, 2013
Answered

If statement structure problem

  • May 3, 2013
  • 1 reply
  • 364 views

for whatever reason my code isnt behaving the way it should, and I was wondering if anyone can take a look at it.

Im trying to prevent something firing if text select is equal to a certain name.

it works when I have just one ex. textSelect.name != "b3" but not when I try to add or statements

if (textSelect.name != "b3"  || textSelect.name !=   "b5"  || textSelect.name != "b6" ||textSelect.name !=   "b7" || textSelect.name != "b8" || textSelect.name != "b9" ||textSelect.name != "b10"||textSelect.name != "b11"||textSelect.name !=  "b12"|| textSelect.name !=  "b13" || textSelect.name != "b14" ) {

          if (textSelect.numLines < 2 && control == "on" && menu1.visible == false)

          {

trace(textSelect.name);

trace("ok");

}

}

This topic has been closed for replies.
Correct answer Ned Murphy

Your logic is not going to work.  It is guaranteed that only one of them at most is going to be equal, so all others have to be not equal.

If you cannot reason out how to code what you really want, explain what you are trying to get the code to do.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
May 3, 2013

Your logic is not going to work.  It is guaranteed that only one of them at most is going to be equal, so all others have to be not equal.

If you cannot reason out how to code what you really want, explain what you are trying to get the code to do.