1 Reply Latest reply on May 5, 2006 12:59 PM by shyaway

    Creating random stars behind everything else

      I've used the following actionscript to generate random "stars" on the stage. I would like all other elements in my movie to be placed above these "stars". I couldn't quite figure out the actionscript to control the depth of my stars so that all other elements will be placed on top of these random stars. As it is now, some stars come in front, others go behind. Thanks!!

      counter = 0;
      _root.onEnterFrame = function(){
      if (counter<=30){
      a = _root.star.duplicateMovieClip("copy", counter);
      a._x =random(Stage.width);
      a._y =random(Stage.height);
      a._xscale = a._yscale = random(100);
      a._rotation = random(360);
      a._alpha = random (100);

      delete this.onEnterFrame;
        • 1. Re: Creating random stars behind everything else
          shyaway Level 1
          if you have all your stuff created in AS, then just assign the lowest depth to it.
          but if layers involved, an easy get around is to create an empty mc symbol and place it on stage in the lowest layer. now, you just update that layer with your stars... and then there's a depth manager class you could also use (more coding).