# \[AS3\] gotoAndPlay strage problem

**URL:** https://forum.kirupa.com/t/as3-gotoandplay-strage-problem/325949
**Category:** programming
**Created:** [November 13, 2011, 8:40pm UTC](https://forum.kirupa.com/t/as3-gotoandplay-strage-problem/325949 "2011-11-13T20:40:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kestor](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kestor](https://forum.kirupa.com/u/kestor)
#### Post date: [November 13, 2011, 8:40pm UTC](https://forum.kirupa.com/t/as3-gotoandplay-strage-problem/325949/1 "2011-11-13T20:40:11Z")

</div>

Hello there.  
For some reason when Enemy1Hp reaches 0 and i say gotoAndPlay(61) it wont play that animation, it just stops on frame(61) and stoped remains.

This is the code inside Enemy11.as

```auto

package  
{
    
    
    import flash.events.KeyboardEvent;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.display.Sprite;
    import fl.motion.DynamicMatrix;
    import flashx.textLayout.accessibility.TextAccImpl;
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.ui.Mouse;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;

    
    
    public class Enemy11 extends MovieClip 
    {
        var _root:Object;
        var Enemy1HP:Number=15;
        var weapon1DMG:Number=5;
        var weapon2DMG:Number=3;
        var fistDMG:Number=50;

        
        
        public function Enemy11() 
        {
            addEventListener(Event.ADDED_TO_STAGE, onAdded);
        }
        private function onAdded(event:Event):void
        {
            gotoAndStop(1);
            _root=MovieClip(root);
            addEventListener(Event.ENTER_FRAME, DamageTaken);

        }
        public function DamageTaken(event:Event):void
        {
            trace(Enemy1HP);
            if(_root.weapon1==true)
            {
                if(this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==7 ||this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==13 ||this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==19)
                {
                    Enemy1HP-=weapon1DMG;
                }
            }
            if(_root.weapon2==true)
            {
                if(this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==27 ||this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==35 ||this.hitTestPoint(_root.aim.x, _root.aim.y, true) && _root.aim.currentFrame==43)
                {
                    Enemy1HP-=weapon2DMG;
                }
            }
            if(_root.fist.currentFrame==3)
            {
                Enemy1HP-=fistDMG;
            }
            if(Enemy1HP<=0)
            {
                Enemy1HP=0;
                this.gotoAndPlay(61);
            }
            if(this.currentFrame==72)
            {
                parent.removeChild(this);
            }
            if(this.currentFrame==60)
            {
                this.gotoAndPlay(48);
            }
        }
    }
}

```

Problem is there where it says if(Enemy1HP\<=0) { gotoAndPlay(61) }  
I gota say that theres no code at all inside the Enemy11 movieclip.  
This is some strange problem, the animation should play.  
Thanks in advance for help.
