5 Replies Latest reply on Apr 12, 2007 5:32 AM by Newsgroup_User

    attachMovie layer problem

    Missing Code Level 1
      Here's my dilemma... I have a program that makes it snow. The three snow flake movie
      clips are linked all to 1 Class called Flake. I am trying to make the randomly created snow
      mc's fall behind my buttons and other mc's that are already on the screen. I have my code
      in the lowest layer, and my buttons and graphics, and movie clips in layers higher up.
      Somehow my snow still manages to stay on top. Please help! I'm really new, so please
      bear with me.

      P.S. - This is done in Flash MX 2004

      -----------the code is in the lowest layer, frame 1---------------
      count = 0;
      _root.onEnterFrame = function()
      {
      count++;
      snowShape = Math.ceil(Math.random() * 3);
      _root.attachMovie("mSnow" + snowShape, "flake_" + count, count);
      currentFlake = eval("flake_" + count);
      currentFlake.index = count;
      }
      ---------------------------------------------------------------
        • 1. Re: attachMovie layer problem
          Level 7
          Place an empty movie clip behind all your other stuff and create the
          snowflakes in that clip instead of _root.


          count = 0;
          _root.onEnterFrame = function()
          {
          count++;
          snowShape = Math.ceil(Math.random() * 3);
          _root.my_empty_movie_clip.attachMovie("mSnow" + snowShape, "flake_" +
          count, count);
          currentFlake = eval("flake_" + count);
          currentFlake.index = count;
          }


          • 2. Re: attachMovie layer problem
            MotionMaker Level 1
            You probably need negative depth for the mSnow objects.
            You also can create an empty MovieClip symbol in the library, place it on stage at 0,0 and a layer behind the other on stage objects and attach the mSnow objects into that blank MC instance.
            • 3. Re: attachMovie layer problem
              kglad Adobe Community Professional & MVP
              move your buttons and other mcs (using swapDepths() ) to higher depths than the max count.
              • 4. Re: attachMovie layer problem
                Missing Code Level 1
                _root.my_empty_movie_clip.attachMovie("mSnow" + snowShape, "flake_" +
                count, count);
                This change seems to have made a big difference. Now the snow is behind the other objects, thanks. Only problem now is I can only make it work right with a non-empty clip. And the size of my flakes seem to be effected by the size of the container mc on the screen. In other words I need to have the movie clip a certain size or it shrinks my snow to small. If I use an empty mc, I see flashes of really big flakes on the screen. Do you know how I can fix the empty flake size problem, or a way I can disconnect the size of the flakes to the movie clip they are in?
                • 5. Re: attachMovie layer problem
                  Level 7
                  Sounds like you've scaled the container movie clip.

                  I don't know why you would need a non-empty clip. Can't you just create a
                  new MovieClip symbol and drop an instance of it at coordinates 0,0? It works
                  for me.