title: Flash AS3 if/else statement not working as expected
body: <p>I am trying to execute this code in flash AS3, but it's not working correctly . In the body of my <code>If</code> condition, I set <code>myFlag = 2</code>, but the <code>if</code> condition always is True!!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var myFlag:int = 1;
  if (myFlag==1)
  {
      s1.addEventListener(MouseEvent.MOUSE_UP,dars1);
      function dars1(e:MouseEvent):void
      {
          myFlag= 2;
          s1.gotoAndStop(25);
          s1.mouseEnabled = false;
          var darsRequest:URLRequest = new URLRequest("dars1.swf");
          var darsLoader:Loader = new Loader();
          darsLoader.load(darsRequest);
          addChild(darsLoader);
      }
  
  }
  else
  {
      trace("NO-CLICK");
  
  }
  </code></pre>