Okay so I have been working on this for like 5 days now and have a huge headache. I came to the conclusion last night while sleeping that I couldnt increment through set without having total number from XML. Soooo I woke up today and rewrote it and now all heck is broke loose.
What I am trying to do is:
Load data from xml into flash, place 6 items of Icon_MC on stage in a grid like pattern and pass the xml data to them. When more_mc is clicked it would cycle through and get next 6. Now that I rewrote this I can access it, however all availible data from xml is loading at once now and overlapping. Please help. This is like the 4th rewrite of this and its driving me absolutely crazy. Here is how I am doing it now:
///Where to start on the x axis
var stageWidth:Number = Stage.width;
///Where to start on the y axis
var stageHeight:Number = Stage.height;
///How Many Colums we want
var colCnt:Number = 3;
///How Many Rows we want
var rowCnt:Number = 2;
///Items per page
var itemsPerPage:Number = 6;
///Width of Item
var itemWidth:Number = 180;
///Height of Item
var itemHeight:Number = 190;
///Margin for top
var marginTop:Number = 190;
///Margin for left
var marginLeft:Number = 260;
///Calculate empty
var emptySpaceWidth:Number = (stageWidth - itemWidth * colCnt) / 2;
var emptySpaceHeight:Number = (stageHeight - itemHeight * rowCnt) / 2;
///Number Of Items
var numOfItems:Number;
///LoadupXML
function loadXML (loaded) {
if (loaded) {
xmlNode = this.firstChild.firstChild.childNodes;
numOfItems = xmlNode.length;
for (var i:Number = 0; i < numOfItems; i++) {
trace (pages);
///Pages of Games
var pages:Number = numOfItems / itemsPerPage;///2 as of now
////Positioning and adding grid style to stage
var x_position:Number = emptySpaceWidth + (i % colCnt) * itemWidth + marginLeft;
var y_position:Number = emptySpaceHeight + ((Math.floor (i / colCnt) % rowCnt) * itemHeight) + marginTop;
////Attaching iconMC
var item:MovieClip = _root.attachMovie ("iconMC", "icon_MC" + i, i+1, {_x:x_position, _y:y_position});
////Setting all Dynamic content to fields
item.logo.logoContainer.loadMovie (xmlNode*.firstChild.attributes.icon);
item.t1.tText.text = xmlNode*.firstChild.attributes.name;
item.link = xmlNode*.firstChild.parentNode.attributes.id;
item.onRollOver = over;
item.onRollOut = out;
item.onRelease = released;
}
} else {
trace ("Not Loading Idiot");
}
}
xmlData = new XML ();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load ("icons.xml");
Icons get placed on stage with proper data in fields however it is putting all of them on stage so its doubling up. There are 12 sets in my XML and I want to show 6 then on click of more_mc it would load next 6. What am I doing wrong? Please help…
Issues now are the doubling up of content and I cant get more_mc button to cycle through to next 6. Please give me a lesson on this. I am doing a customization of this tutorial here:http://www.kirupa.com/developer/actionscript/multiDimArrays_attach.htm
Thanks in advance. Please drop knowledge on me. Its been 5 days and im lost on multi dimensional arrays.