Hi, I have this code that I’ve used before to dynamically attach a movieclip to create one long list of movieclips, however for a design I’m working on I need to be able to create multiple columns of 4 (configurable) items so the 5th items get’s a new _x position, and starts over calculating the _y position.
I hope that makes sense. I’ve attached the code that i’m starting out from, but if you find it easier to scrap this feel free.
Thanks!!
var x:XML = new XML();
x.ignoreWhite = true;
var thumb:Array = new Array();
var thumbTitle:Array = new Array();
var thumbDesc:Array = new Array();
var xPos:Number = 0;
var yPos:Number = 0;
x.onLoad = function(success) {
var thumbs:Array = this.firstChild.childNodes;
var totalThumbs = thumbs.length;
for (i=0; i<thumbs.length; i++) {
thumbImage.push(thumbs*.attributes.thumb);
thumbTitle.push(thumbs*.attributes.thumbTitle);
thumbDesc.push(thumbs*.attributes.thumbDesc);
myThumbs.empty_mc.attachMovie("thumbData", "thumbData"+i, i, {_x:xPos, _y:yPos});
yPos += _root.myThumbs.empty_mc["thumbData"+i]._height+3;
_root.myThumbs.empty_mc["thumbData"+i].thumb_mc.loadMovie(thumbImage*);
_root.myThumbs.empty_mc["thumbData"+i].thumbTitle.text = thumbTitle*;
_root.myThumbs.empty_mc["thumbData"+i].thumbDesc.text = thumbDesc*;
}
};
x.load("data/thumbs.xml");