title: Action Script 3. Continue animation till last frame without interrupting
body: <p>I'm creating flash game. Here are 3 different attacks with different animations (keyboard bind z, x, c). </p>
  
  <p><strong>Problem #1</strong> </p>
  
  <p>For example If I use attack1 (by clicking "z") It shows animation with ~100 frames, but If during animation I clicking attack2 (x) It cancels attack1 animation and start playing attack2 animation. I need to make that when during animation It can't be interrupted by using other animation.</p>
  
  <p><strong>Problem #2</strong></p>
  
  <p>If I use attack1 (by clicking "z") and hold "z" animation freezes till I release "z" button. I need to make that If I click any attack button once started play animation and It can't be interrupted/paused by clicking the same button.</p>
  
  <p>In every attack MovieClip in last frame I added code <code>MovieClip(this.parent).gotoAndStop("stay");</code> that after attack animation played It started playing "stay" animation (this part working).</p>
  
  <p>key_down function:</p>
  
  <pre><code>private function key_down(event:KeyboardEvent)
  {
      if (event.keyCode == 90)
      {
          attack1 = true;
      }
      if (event.keyCode == 88)
      {
          attack2 = true;
      }
      if (event.keyCode == 67)
      {
          attack3 = true;
      }
  
  }
  </code></pre>
  
  <p>key_up function:</p>
  
  <pre><code>private function key_up(event:KeyboardEvent)
  {
  
      if (event.keyCode == 90)
      {
          attack1 = false;
      }
      if (event.keyCode == 88)
      {
          attack2 = false;
      }
      if (event.keyCode == 67)
      {
          attack3 = false;
      }
  }
  </code></pre>
  
  <p>startAttack() function</p>
  
  <pre><code>private function startAttack() {
  
              if (attack1)
              {
                  Hero.gotoAndStop("attack1");
              }
              if (attack2)
              {
                  Hero.gotoAndStop("attack2");
              }
              if (attack3)
              {
                  Hero.gotoAndStop("attack3");
              }
  }
  </code></pre>