2 Replies Latest reply on Oct 17, 2008 2:32 PM by Parlian

    attaching movieclips with a for loop

      Hello there, I am stuck with changing from a random attachMovie to an orderly attachMovie set up

      The initial setup was for a mc to be randomly picked and displayed from a pool of mcs
      This was realised with having four levels
      a) pool of movieclips "mcPool"
      b) movieclip with "mcContainer" to which mcs of "mcPool" are randomly attached, by changing LinkageID with Math.random
      c)another movieclip holding b) to tween it into motion with a stop function at the end of the timeline.
      d)Scene1, attaching movieclip c) to a container and removing movieclips at the end of the timeline.

      The stop function at the end of c) in combination with the removing of mcs at the end of d) initiated the random pick from the pool in b) with each loop of the timeline of d).

      Now I would need b) to pick from the pool in a certain order. I cannot think of a way how I can get b) to count and the to store the incremented variable so that it is available again when d) attaches c) again after the timeline loop.

      I realise that I might have to reorganise the whole construct and would be happy about help.

      Thank you in advance


        • 1. Re: attaching movieclips with a for loop
          clbeech Level 3
          although I not certain that I completely 'follow' the whole procedure (lol) there would a few ways to go about this. it sounds like a FOR loop isn't what you're looking for since it will execute 'all' of the loops until the condition is satisfied and then move on in the code block. so i think that what you may need is to store the values (mc linkage names) within an array (as Strings) and then track an index variable that is used to access the next element in the array. if you are uncertain of being able to call 'back' to the mcContainer clip from d) when the time comes to increment the variable - you could also use a method on the root to control the entire operation - call to the method from d) and increment the variable within the method 'after' the selection from the array has been made.
          • 2. Re: attaching movieclips with a for loop
            Parlian Level 1
            Hello clbeech

            Thank you for your response, I am going to look for a solution from this direction.