4 Replies Latest reply on Apr 3, 2008 9:08 AM by aniebel

    Please help with the FOR loop and the array..

    Level 7
      I was trying to place some words in the Movie Clip "TextPanel" and set a
      random position to each of them.
      But it's not working.

      1) I created a Movie Clip "word" and inside that MC I created a text field
      and gave it an identifier "textFiled".
      2) The linkage name for Movie Clip "word" I set to "word".
      3) In the actionscript I created an Array called "aWords".
      4) Then I created a FOR loop that should
      place (attach) Movie Clips "word0", "word1", "word2" and "word3" to the
      movie clip TextPanel, and set the textField text for each of them to the
      text from the Array.

      But the script attaches 4 Movie Clips with a name "Undefined", instead of 4
      different names (from the Array).
      What is wrong with this script?

      var aWords:Array = [apple,banana,orange,mango];

      var v = TextPanel.attachMovie("word","word"+i,i);

      v.textFiled.text = aWords ;

      v._x = randomNumber(0,Stage.width);
      v._y = randomNumber(0,Stage.height);

      Thanks in advance