3 Replies Latest reply on Apr 13, 2007 2:04 PM by kglad

    If statement =! working

    realworks
      I’m loading Flash vars from my page using a Javascript shown here:
      quote:

      <script type="text/javascript">
      var1 = "foo";
      var2 = "";
      </script>



      I'll make this short. The vars do get into my Flash movie and all works fine when the vars have values. But I need to check if the vars have values and if not skip a function.

      Here is the if statement I’m having trouble with:
      quote:


      if (var2=!undefined) {
      attachMovie("MC", "MC", 1);
      }


      If var2 has no value, the MovieClip "MC" still gets shown.. I've tried adding var2=null; in the JavaScript but the MovieClip is still shown. I know "if var2 not undefined" is probably a strange way to check a value. I've tried "if var2 undefined - return;} else { attach MovieClip" and that doesn't recognize the empty value either :(

      Any help is greatly appreciated!