3 Replies Latest reply on Dec 7, 2010 6:51 PM by kglad

    dymically created MC follow ._x of the parent dynamically created MC?

    WitchXHunter

      So..I

      I'm trying to create a life bar for a dymically created character. and I want the life bar to follow the movement of that character, it follow only the current created character. meaning when a new character appears the liftbar will move according to the newest character. anyone have any idea on how to track the character it was created in? Thanks

       

      var birdE = createMC("birdy", 800, 180);
      birdE.speed = _root.enemy_move_speed+random(10);

      _root.enemy_list1.push(birdE);


      var LifeB_mc = createMC("lifebar", birdE._x, birdE._y-60);
      LifeB_mc.onEnterFrame = function() {
      var BLB_mc:MovieClip;
        for (i in _root.enemy_list1) {
        
          BLB_mc= _root.enemy_list1[i];
          this._x = BLB_mc._x;
         
        
        }

      return;
      }



      }



      birdE.onEnterFrame = function() {
       
       
        if (this.hitTest(_root.scratch_mc)) {
        
         _root.taffy.gotoAndStop("Mpain");
           _root.HPno--;
           hitted = true;
          
           removeMovieClip(_root.birdE);
         
      }
        
       
      this._x-= 20;
      if (this._x<-1000 || this._x>(800+50)) {
      removeMovieClip(this);
      return;
      }
      }

       

      if (random(30) == 0) {
      var ****_mc = createMC("****", birdE._x, birdE._y);
      ****_mc.onEnterFrame = function() {
      this._y += 10;


      if (this._y>600) {
      removeMovieClip(this);
      return;
      }
      }
      }
      }