1 Reply Latest reply on May 21, 2007 2:02 AM by Gooms9

    Passing movie clip names to functions

    Gooms9
      Hey, i'm trying to create a game where I need to be able to spawn a bunch of different kinds of enemies so i figured i'd write a function to create an enemy. I've attached what I came up with.

      now i'm assuming the problem is with these 2 lines. Am I allowd to pass data to a function and use it this way? Is there a special way I'd go about doing it? Can anybody suggest a better way to write this code? Thanks.


      this.createEmptyMovieClip(_root[enemyName], this.getNextHighestDepth());
      _root[enemyName].attachMovie(_root[enemyPicture], "enemyBlue1", this.getNextHighestDepth());
        • 1. Re: Passing movie clip names to functions
          Gooms9 Level 1
          nevermind, i figured it out. I just changed

          this.createEmptyMovieClip(_root[enemyName], this.getNextHighestDepth());
          _root[enemyName].attachMovie(_root[enemyPicture], "enemyBlue1", this.getNextHighestDepth());

          to

          this.createEmptyMovieClip(enemyName, this.getNextHighestDepth());
          _root[enemyName].attachMovie(enemyPicture, "enemyBlue1", this.getNextHighestDepth());