Scrollpane: dynamic content

Hi guys,

My first post in this forum :stuck_out_tongue:

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

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

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

Hello,

I managed today to do this magic… I use xml to load the url’s with thumbnails. Mail me at 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 :slight_smile:
Checkout www.barts.nl next week, say from 30 september 2004.

But here is my code:

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

// fill in your server
_global.URL = “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(“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 = “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;
}
};
}