# Scrollpane: dynamic content

**URL:** https://forum.kirupa.com/t/scrollpane-dynamic-content/62195
**Category:** Uncategorized
**Created:** [August 25, 2004, 7:01pm UTC](https://forum.kirupa.com/t/scrollpane-dynamic-content/62195 "2004-08-25T19:01:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bava](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bava](https://forum.kirupa.com/u/bava)
#### Post date: [August 25, 2004, 7:01pm UTC](https://forum.kirupa.com/t/scrollpane-dynamic-content/62195/1 "2004-08-25T19:01:35Z")

</div>

Hi guys,

My first post in this forum 😛

I’ve created a Flash service through which I get a list of categories.  
For each category, I create a button using attachMovie: works great.

Now, what I want to do is add these buttons to a scrollpane so that the list can grow as large as I want it to: any ideas on how to do this? I’ve already tried to add the buttons to the scrollpane like

myScrollpane.attachMovie("…

This results in the buttons being created but the scrollpane isn’t scrollable.

Any help woud be greatly appreciated,

bava

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 25, 2004, 7:31pm UTC](https://forum.kirupa.com/t/scrollpane-dynamic-content/62195/2 "2004-08-25T19:31:00Z")

</div>

I’ve already found out that I have to create a movieclip and export it for actionscript: setting the contentpath of the scrollpane to that movie will make the scrollpane work.  
But how do I add other movieclips dynamically to that movieclip so that I can scroll the dynamically loaded movieclips?

Thnx

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 24, 2004, 6:33am UTC](https://forum.kirupa.com/t/scrollpane-dynamic-content/62195/3 "2004-09-24T06:33:14Z")

</div>

have you found an answer? 'cause I’m stumped too…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 24, 2004, 4:26pm UTC](https://forum.kirupa.com/t/scrollpane-dynamic-content/62195/4 "2004-09-24T16:26:16Z")

</div>

Hello,

I managed today to do this magic… I use xml to load the url’s with thumbnails. Mail me at [info@zoo.nl](mailto:info@zoo.nl), then I send you my files, they are to big for this list.  
Took me almost a complete week to put it together. I’m also for hire to do the job for you 🙂  
Checkout www.barts.nl next week, say from 30 september 2004.

But here is my code:

// copyleft studio ZOO, [http://www.zoo.nl](http://www.zoo.nl)  
// released under GNU GPL licence, leave this notice intact

// fill in your server  
\_global.URL = “[http://someserver](http://someserver)”;

this.onLoad = onThisMovieLoaded;

// initiate xml loading  
LoadCol();

// xml load function  
function LoadCol() {  
catId = \_level0.catId;  
mcLoader.contentPath = \_level0.catImage;  
var colXml = new XML();  
colXml.ignoreWhite = true;  
colXml.onLoad = onColXmlLoaded;  
colXml.load(\_global.URL + “/include/php/collection\_xml.php?catid=2”);  
[//colXml.load](https://colXml.load)(“[http://www.barts.nl/include/php/collection\_xml.php?catid=](http://www.barts.nl/include/php/collection_xml.php?catid=)” + catId);  
}

// get the xml parts, put them in emptymovieclips, put the emptymovieclips as content in a scrollPane  
// make sure you have a scrollPane on stage, and name myScrollPane  
function onColXmlLoaded() {  
arColNodes = this.firstChild.childNodes;  
myScrollPane.contentPath = “Empty”;  
myScrollPane.border = false;  
sc = myScrollPane.content;  
[//myScrollPane.hScrollPolicy](https://myScrollPane.hScrollPolicy) = “off”;  
for (i=0; i\<arColNodes.length; i++) {  
var currentId = arColNodes\*.attributes.id;  
var currentName = arColNodes\*.attributes.name;  
var colImage = arColNodes\*.attributes.image1;  
// this is the path to my thumbnails  
var image2\_url = \_global.URL + “/repository/tn/”+colImage;  
s = currentId;  
sc.createEmptyMovieClip(s, i);  
sc[s].createEmptyMovieClip(“holder”, i+100); // \<- watch the depth  
sc[s].holder.loadMovie(image2\_url); // \<- change path

```
      // the next rule is a stupid hack, to get the scrollPane to show
      // the scrollbars, the textfield is not used
      // maybe an emptymovieclip does the trick, I guess
      sc[s].holder.createTextField("pT", i, 0, 0, 100, 20);
      
      // give the movieclip an ._y position for a horizontal scrollPane
      sc[s].holder._y = i*100;
      sc[s].setSize(100, 100);
      sc[s].onPress = function() {
          thisId = this._name;
          loadProduct(thisId);
      };
  }

```

}  
function loadProduct() {  
lv = new LoadVars();  
System.useCodepage = true;  
url = \_global.URL + “/include/php/product2.php?id=”+thisId;  
lv.load(url);  
lv.onLoad = function(success) {  
if (success) {  
txtProductName.text = this.ProductName;  
txtProductNumber.text = this.ProductNumber;  
txtProductColors.text = this.ProductColor;  
mcLoader.contentPath = \_global.URL + “/repository/”+this.ProductImage;  
}  
};  
}
