Leave out menu items not required

In a previous post, I asked how it were possible to have a XML-driven dynamic menu in Flash where you could tell it how many columns to display in. Scotty directed me towards the following code:

var thumb_spacing = 40;
var columns = 5;//change this one to the number of thumbs you want to have in a row
// load variables object to handle loading of text
var description_lv =new LoadVars();
description_lv.onData =function(raw_text) {
description_txt.text = raw_text;
function GeneratePortfolio(portfolio_xml) {
var portfolioPictures = portfolio_xml.firstChild.childNodes;
for (var i = 0; i<portfolioPictures.length; i++) {
var currentPicture = portfolioPictures*;
var currentThumb_mc = menu_mc.createEmptyMovieClip("thumbnail_mc"+i, i);
currentThumb_mc._x = (i%columns)*thumb_spacing;
currentThumb_mc._y =Math.floor(i/columns)*thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container", 0);
currentThumb_mc.thumb_container.loadMovie(currentP icture.attributes.thumb);
currentThumb_mc.title = currentPicture.attributes.title;
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.description = currentPicture.attributes.description;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver=function () {
info_txt.text =this.title;
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut=function () {
info_txt.text = "";
currentThumb_mc.onRelease =function() {

Cheers for that Scotty.

Now, I don’t 100% understand this script, and was wondering what part of the script tells it how many menu items there are to be displayed, and how I can change that.

The reason being is that the way I’ve implemented this script is within a menu that only displays certain items pulled from an XML document (by using an if statement > if myrelateditemname = oneoftheotheritemnames then success - that kinda thing). The problem is, it still seems to be going by the total number of items in the XML document to display the menu, rather than the total number of items that achieved success in the if statement, therefore, when the menu displays, it is leaving gaps where the unsuccessful items would be displayed…

So, all I’m after is if someone could identify which part in the above code controls the total number of items to be displayed in the menu.