1 Reply Latest reply on Oct 31, 2011 7:02 PM by Rothrock

    VERY VERY basic (and a bit worrying) !

    Tony Heagren Level 1

      Hi all,

       

      something has either gone awry in my head, with the player or with the universe since neutrinos sped

      into Itlay faster than Albert said they should have.

       

      I have a simple equality test that keeps going wrong in a project.

      So I built a test file to test my syntax and thinking - and that goes wrong too.

      Trouble is - I've been using this for YEARS and it's worked fine forever.

      Can someone please tell me if I've had a senior moment, a rush of blood to the head or if something has changed ?

       

      A one frame test movie. Three text boxes on the stage.

      One is dynamic, variable name is "foo" - next is input, variable name is "blah"

      Last is dymanic, variable name is "grr"

      Then a button.

      A frame action that says "foo = "123";

      type 123 into into "blah" and use the button to test equality between foo and blah like this:

       

      on (release) {

          if (blah == foo) {

              grr = "Groovy";

          } else {

              grr = "Noooooo";

          }

      }

       

      I expect the result in "grr" to be HAHA becasue 123 is precicesly the same as 123.

      But I get Nooooo every time - why ? 

       

      I thought I knew this (backwards, with finese, with numbers, strings and within arrays) but it seems like I'm forgetting my ABCs in actionscript because I cannot make it work !!!!

       

      Download the test file here:

      www.heagren.com/flash/test.fla.zip

      And please upload it fixed with notes or just tell me what I'm (suddenly after many years) getting wrong !!!

       

      Best wishes (and a bit worried about my own head)

      Tony

        • 1. Re: VERY VERY basic (and a bit worrying) !
          Rothrock Level 5

          First thing to check would be that the values are local and what you think at the time. Because regardless of what you think should happen Flash does what we tell it, not what we want.

           

          So add a trace before your contitional:

           

          trace("The values are: "+[blah,foo]);

           

          So what do you get there?

           

          Assuming they are the same, the next thing to suspect is that one is perhaps a string and the other is maybe a number.

           

          And foo="123 is certainly a string. Is the other value?