# Using for loop with scrollPane

**URL:** <https://forum.kirupa.com/t/using-for-loop-with-scrollpane/159572>\
**Category:** Uncategorized\
**Created:** [August 18, 2005, 1:07pm UTC](https://forum.kirupa.com/t/using-for-loop-with-scrollpane/159572 "2005-08-18T13:07:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)\
**Post date:** [August 18, 2005, 1:07pm UTC](https://forum.kirupa.com/t/using-for-loop-with-scrollpane/159572/1 "2005-08-18T13:07:45Z")

</div>

I am trying to load pictures into my scrollPane and thus make thumbnails of them. I have simple set up, a scrollPane instance name “myScrollPane”, a movieclip with a Loader control in it, the Loader instance name is myLoader, and the movieClip instance name is mc\_container.

Now I have been successful in adding the movieClip to myScrollPane, but I don’t know how to loop through it. I tried something like this, but no images show up, the first movieClip seems doubled up and the scroll bars aren’t working.The scrollpane looks like this(see attachment).

Does anyone have any ideas.

```auto

var myScrollPane:mx.containers.ScrollPane;
myScrollPane.contentPath = 'mc_container';
//
MyPicVars = new LoadVars();
MyPicVars.load("jetPlane.txt");
MyPicVars.onLoad = function(success) {
if (success) {
//trace("loaded");
var t_mc:MovieClip;
Rc = this["Rc"];
//trace(Rc); 
for (i=0; i<=Rc-1; i++) {
t_mc = myScrollPane.content.attachMovie("mc_container", "mc"+i, i, this.getNextHighestDepth());
t_mc._x = 5;
t_mc._y = 5+(i*80);
myScrollPane.content.myLoader.contentPath = "jetPlane/"+this["pic"+i];
t_mc.i = i;
t_mc.location = this["pic"+i]; 
}
} else {
trace("not loaded");
}
}

```
