4 Replies Latest reply on Jul 3, 2010 5:14 AM by AESS1981

    Random mc from library array

    AESS1981 Level 1

      Hi there,

       

      I have 15 empty placeholder on my stage, named "empty01" - "empty15".

      I have 15 mcs in my library, with linkage identifiers "01" - "15".

       

      At the moment, an empty placeholder attaches a specific library mc:

      empty01.attachMovie("01", "01", 1);

      empty02.attachMovie("02", "01", 1);

      empty03.attachMovie("03", "01", 1);

       

       

      I would prefer for 'empty01' to load a random mc. Can anyone advise how I could achieve this?

      I have tried to create an array containing the 15 library mcs (not sure if this is correct):

       

      var myClips:Array = new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15");

      then load a random library mc into each empty placeholder.
      var currentClip = random(myClips.length);
      empty01.attachMovie(myClips[currentClip]);
      empty02.attachMovie(myClips[currentClip]);
      empty03.attachMovie(myClips[currentClip]);    ....

      This doesn't seem to work...
      Many thanks