3 Replies Latest reply on Dec 8, 2013 10:43 AM by resdesign

    Simple variable problem

    boxofspiders Level 1

      This is a realy simple problem and I'm probably just being a bit dim but as I don't code things very often even the simple stuff tends to leave my brain.

       

      Summed up simply I have an if statement that instead of using the current value of a variable seems to be setting it instead.

       

      More detailed description:

       

       

      I have 2 symbols, "Olive" which is an animation with three labelled timeline positions, 'open, 'set' and 'closed' each of which set the value of variable 'positionO' accordingly. I've tested that bit with alerts and is fine.

       

      When I mouse over the second symbol I want it to grab the variable and play different parts of the animation depending on it's value, so far so good?

       

      I've got this bit of code on the mouseover element:

       

      var myVariable = sym.getComposition().getStage().getSymbol("Olive").getVariable("positionO");
      if (positionO = 'open'){
      alert (positionO);
      }
      

       

      Now to me that should fire the alert if the variable has the value 'open' and do nothing if the value is anything else but what it is actually doing is setting the variable to 'open' and the firing the alert anyway.

       

      Thanks in advance,

       

      Alex.