2 Replies Latest reply on Nov 12, 2007 9:03 AM by joeflashTO

    array and movieclip

    Level 7

      how can i declare an array of movieclips ?


        • 1. Re: array and movieclip
          Level 7
          I would like to precise my idea :

          for example i defined an array like that :
          var ArrayFlake:Array = new Array();

          i have a random int which will define how many movieclip i will have to
          store into my array :
          var i:int;

          where "i" is defined later.

          i have 1 movieClip in my library call 'flake'

          so i do not want to do :
          var mcFlake1:MovieClip = new flake;
          var mcFlake2:MovieClip = new flake;
          var mcFlake3:MovieClip = new flake;

          but more :

          ArrayFlake .push('mcFlake'+i);
          and after create the new instance of mcFlake1, mcFlake2, ... automatically.
          and this i do not know for now..
          i can not write for each(flake:* in ArrayFlake)
          var ArrayFlake
          :MovieClip = new flake;
          this.AddChild(ArrayFlake );

          and later us the 'mcFlake1','mcFlake2',...


          R.A.F. wrote:
          > Hi,
          > how can i declare an array of movieclips ?
          > thx.
          > RAF
          • 2. Re: array and movieclip
            joeflashTO Level 1
            First, as a best practise, I try to reserve single-letter variables for counters. Second, as a best practise, properties should be prefaced with a lower-case letter; uppercase is usually reserved for class names. And third, it's "addChild", not "AddChild".

            Try this: