Hello
I created a simple xml generated agenda on flash 8 / actionscript 2
The first node define the months, the second the days and location.
Id like the month vertical position to adapt itself to the previous month height.
I have no problem to detect how much days are within a month,
but for now the position is fixed and doesn’t adapt itself.
I added a few comments to the code.
Does anyone have a clue where my mistake is?
I can of course provide a fla and xml file if needed
Thanks to all.
Hervé
function loadXML(loaded) {
if (loaded) {
month = new Array();
date = new Array();
location = new Array();
day = new Array();
xmlNode = this.firstChild;
totali = xmlNode.childNodes.length;
for (i=0; i<totali; i++) {
if (xmlNode.childNodes*.nodeName == "month") {
month.push(xmlNode.childNodes*.attributes.month);
currentMonth = xmlNode.childNodes*.attributes.month;
currentNode = xmlNode.childNodes*;
//here i detect how much days within a month
totalj = currentNode.childNodes.length;
//I make a trace that shows correct result
trace("totalj"+totalj);
var mc:MovieClip = content.attachMovie("month", "month"+i, i);
mc.id = i;
mc.month_text.text = currentMonth.toUpperCase();
//here is the code supposed to define each mc vertical position
mc._y = Math.round(30+(totalj*18)*i);
//another trace that show me that the position is fixed instead of adapting itself
trace("mc._y"+mc._y);
for (j=0; j<totalj; j++) {
if (currentNode.childNodes[j].nodeName == "day") {
date.push(currentNode.childNodes[j].attributes.date);
location.push(currentNode.childNodes[j].attributes.location);
currentDate = currentNode.childNodes[j].attributes.date;
currentlocation = currentNode.childNodes[j].attributes.location;
var mc2:MovieClip = mc.attachMovie("day", "day"+j, j);
mc2.id = j;
mc2.date_text.text = currentDate;
mc2.location_text.text = currentlocation.toUpperCase();
//here is the code to define the position of each 'day' clip
mc2._y = Math.round(18+(mc2._height)*j);
}
}
}
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("agenda.xml");