Ok, here we go again…
Never had to manipulate this before, I’m surprised the following problem occured:
buttText is Dynamic text placed in a button. The button is placed in a MC called agendaWindow. Function activateMonthButtons() is placed in the _root (_level0), so is the MC. Now, I want to change the .textColor of buttText, in reaction of the triggered function.
It doesn’t do a thang. When I convert the button to a mc manually, everything works well… (but I want it to stay a button).
The related part of my script:
//DATE -----------------------------
thisDate = new Date();
thisYear = thisDate.getFullYear();
// XML's USED ----------------------------
thisYearXMLname = "Agenda" + thisYear + ".xml";
thisYearXML = new XML();
thisYearXML.ignoreWhite = true;
// THE FUNCTIONS -------------------------
thisYearXML.onLoad = function(success){
thisYearXML.contentType = "text/xml";
if (success){
activateMonthButtons(thisYearXML);
}
else{
Trace("LOAD ERROR");
}
}
// XML's LOAD
/*myIdentifier=Math.round(Math.random()*10000);*/
thisYearXML.load(thisYearXMLname/*+"?uniq="+myIdentifier*/);
// NESTED FUNCTION ------------------------
function activateMonthButtons(whatYear) {
monthArray = new Array(_root.agendaWindow.buttjan, _root.agendaWindow.buttfeb, _root.agendaWindow.buttmaa, _root.agendaWindow.buttapr, _root.agendaWindow.buttmei, _root.agendaWindow.buttjuni, _root.agendaWindow.buttjuli, _root.agendaWindow.buttaug, _root.agendaWindow.buttsept, _root.agendaWindow.buttokt, _root.agendaWindow.buttnov, _root.agendaWindow.buttdec);
amountDays = new Array();
totalDaysContent = new Array();
for(i=0; i<12; i++){
amountDays* = whatYear.firstChild.childNodes*.childNodes.length;
if (amountDays* == 0){
monthArray*.enabled = false;
/* THE PROBLEM!! */ monthArray*.buttText.textColor = 0x123456
}
for(j=0; j<amountDays*; j++){
totalDaysContent* += whatYear.firstChild.childNodes*.childNodes[j].firstChild.toString();
}
if (totalDaysContent* == 0) {
monthArray*.enabled = false;
}
}
};
The problem (see ‘[color=mediumturquoise]/THE PROBLEM!!/[/color]’) here is that I try to enter the Button wrongly. When I manually convert the button (i.e. buttfeb) to an mc, I get entrance and the buttText.textColor changes as asked.
The rest of the code isn’t really important, it’s a bit chunky at the moment, but it works. I just started creating it from scratch, the cleaning comes afterwards.
Got a clue?