grappaFruit
June 17th, 2004, 08:54 AM
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[i] = whatYear.firstChild.childNodes[i].childNodes.length;
if (amountDays[i] == 0){
monthArray[i].enabled = false;
/* THE PROBLEM!! */ monthArray[i].buttText.textColor = 0x123456
}
for(j=0; j<amountDays[i]; j++){
totalDaysContent[i] += whatYear.firstChild.childNodes[i].childNodes[j].firstChild.toString();
}
if (totalDaysContent[i] == 0) {
monthArray[i].enabled = false;
}
}
};
The problem (see '/*THE PROBLEM!!*/') 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?
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[i] = whatYear.firstChild.childNodes[i].childNodes.length;
if (amountDays[i] == 0){
monthArray[i].enabled = false;
/* THE PROBLEM!! */ monthArray[i].buttText.textColor = 0x123456
}
for(j=0; j<amountDays[i]; j++){
totalDaysContent[i] += whatYear.firstChild.childNodes[i].childNodes[j].firstChild.toString();
}
if (totalDaysContent[i] == 0) {
monthArray[i].enabled = false;
}
}
};
The problem (see '/*THE PROBLEM!!*/') 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?