AttachMovie and Loop

Hello all -

I am having a bit of a problem and I would like some input on how to solve it. What I am trying to do is design a game where users design a park, by dragging trees, benches, flowers, etc., onto the stage in the position that they want to. THey can save the layout, and return later to see their work and to move stuff around if they want.

So far the first part is working, but I am having some difficulty when trying to loop through the saved layout and recreating it.

After the users create the first layout, I capture the x, y, and rotations of each object. Then I figured that I could just loop through this information to recreate it on their next visit…that is the part that is not working. Here is my current code:

In an external text file:

&piece=1&xCoord=400&yCoord=150&Rotation=45&
&piece=1&xCoord=450&yCoord=200&Rotation=45&
&piece=1&xCoord=350&yCoord=250&Rotation=90&

And the AS:

myVars = new LoadVars(); 
myVars.onLoad = function(success) {
 if (success) {
 var b:Number;                     
  for (b = 0; b < 4; b++) {
  var treenumber ="tree"+b;
  trace (treenumber);
 xCoord = this.xCoord;
 yCoord = this.yCoord;
 Rotation = this.Rotation;
 //populate text field
 attachMovie("Treedragmovie", "Treedragmovie"+b, b, {_x:xCoord, _y:yCoord, _rotation:Rotation});
 myBody_txt.htmlText = Treenumber+"<br />"+xCoord+"<br>"+yCoord+"<br>"+Rotation;
 //trace (desknumber);
} 
}
else {
// what to do in case of data error
myBody_txt.htmlText = "<b>Error loading Data</b>";
}
};
// now load the text file
myVars.load("class.txt");
stop();

The result is only one tree being attached on the stage, and the text field only showing the last of the three records. The initial two are left off. Does anyone have any ideas on this?

No.44