title: Actionscript 3: How to make movieclip variables work with variables on stage (Healthbar Help)
body: <p>I am totally new at this whole programming thing, and I really need help. So basically, I'm trying to make a healthbar that will increase or decrease depending on what button is clicked. I made a healthbar movieclip with 101 frames (I included zero) and put this in the actionscript layer of the movieclip:</p>
  
  <pre><code>var health:Number = 0;
  
  if(health == 0)
  {
          gotoAndStop("1")
  }
  
  if(health == 1)
  {
          gotoAndStop("2")
  }
  
  if(health == 2)
  {
          gotoAndStop("3")
  }
  </code></pre>
  
  <p>and on and on like so. Basically, on the stage itself, I have a button called fortyfiveup_btn that is commanded to do this: </p>
  
  <pre><code>var health:Number = 0;
  
  fortyfiveup_btn.addEventListener(MouseEvent.CLICK, fortyfiveupClick);
  function fortyfiveupClick(event:MouseEvent):void{
      health = health+45
  }
  </code></pre>
  
  <p>I quickly realized that both health variables, the one for the button and the one for the healthbar will not interact. How can I make it so if the button is clicked, the health goes to the relevant frame or percentage?</p>
  
  <p>Thanks for any answers, and I appreciate all the help I can get :)</p>