I am generating some dynamic logos from an xml and have a question as to why when i load with the number 3 it will load 3 colum 2 rows. However it wont show all items from XML. Here is how I am trying to go about it.
var numOfItems:Number;
var games:MovieClip = this;
var hspace = 10;
// ten pix space on the sides
var vspace = 10;
// ten pix space on the bottom
startCount = 1;
//counter to keep track of what step we're on
xStart = 384;
// where to start on the x axis
yStart = 300;
// where to start on the y axis
////GetEm
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for (var i = 0; i<numOfItems; i++) {
var t = games.attachMovie("iconMC", "iconMC"+i, i+1);
t._x = xStart;
t._y = yStart;
t.swapDepths(0);
// set x and y for this clip
if (startCount != 3) {
// find out how many we have in a row
var xStart = Math.round(t._x+t._width+hspace);
// only change horizontal
startCount++;
// add one to the count
} else {
// if we're on number 4 reset everything
var xStart = 384;
var yStart = Math.round(t._y+t._height+vspace);
var startCount = 1;
////
t.logo.logoContainer.loadMovie(nodes[i].attributes.logo);
t.t1.tText.text = nodes[i].attributes.title;
t.t2.cText.text = nodes[i].attributes.category;
t.link = nodes[i].attributes.link;
t.onRollOver = over;
t.onRollOut = out;
t.onRelease = released;
}
}
};
xml.load("icons.xml");
- var numOfItems:Number;
- var games:MovieClip = this;
- var hspace = 10;
- // ten pix space on the sides
- var vspace = 10;
- // ten pix space on the bottom
- startCount = 1;
- //counter to keep track of what step we're on
- xStart = 384;
- // where to start on the x axis
- yStart = 300;
- // where to start on the y axis
- ////GetEm
- var xml:XML = new XML();
- xml.ignoreWhite = true;
- xml.onLoad = function() {
- var nodes = this.firstChild.childNodes;
- numOfItems = nodes.length;
- for (var i = 0; i<numOfItems; i++) {
- var t = games.attachMovie("iconMC", "iconMC"+i, i+1);
- t._x = xStart;
- t._y = yStart;
- t.swapDepths(0);
- // set x and y for this clip
- if (startCount != 3) {
- // find out how many we have in a row
- var xStart = Math.round(t._x+t._width+hspace);
- // only change horizontal
- startCount++;
- // add one to the count
- } else {
- // if we're on number 4 reset everything
- var xStart = 384;
- var yStart = Math.round(t._y+t._height+vspace);
- var startCount = 1;
- ////
- t.logo.logoContainer.loadMovie(nodes[i].attributes.logo);
- t.t1.tText.text = nodes[i].attributes.title;
- t.t2.cText.text = nodes[i].attributes.category;
- t.link = nodes[i].attributes.link;
- t.onRollOver = over;
- t.onRollOut = out;
- t.onRelease = released;
- }
- }
- };
- xml.load("icons.xml");
I am trying to get 6 items showing from XML with a button that would grab next set. Which I havent written out yet. Right now I am stuck with just getting 6 to show properly. Any ideas are much appreciated. Thanks in advance