2 Replies Latest reply on Feb 12, 2008 2:20 PM by DIY_Lobotomy

    attachMovie code...

    DIY_Lobotomy Level 1
      I'm trying to write a function to take linked MCs out of the library and place a set number of them on the stage at a random location with a random rotation and a random size (between 50%-100%). Can you please see what's wrong with my code? I think it's something in my "attachMovie" part.

      The linked clips from the library are "bug1_mc", "bug2_mc", and "bug3_mc". Thanks!...
        • 1. Re: attachMovie code...
          Rothrock Level 5
          Check the help files for MovieClip.attachMovie(). You will see that it takes the arguments of string, string, number, and optionally and object.

          So in the first position you mClip which is a MovieClip. I would think that should generate and error. But in any event it needs to be a string. So you need to change your functions arguments and you need to call it like:


          Next in your attachMovie, you have mc+i as the second string. I'm not sure what mc is supposed to be. Perhaps you want the clips to be called mc1, mc2, etc.? In that case your second argument should be "mc"+i. (Quotes around the mc part because it isn't a variable, but rather a string constant.) However you will run into problems because each time you call the function it will start with i=0 and you will end up with clips with the same names. So perhaps a better choice would be mClip+i. (No quotes around that because it is already a string.)

          Finally, I'm not sure if it is a problem, but for the depth I'm not sure what the current scope is and if it is actually attaching where you want. So you might want to make sure your scope is working.
          • 2. Re: attachMovie code...
            DIY_Lobotomy Level 1
            Thanks! That was a lot of good info, and I fixed what I needed to. Thanks!!!