0 Replies Latest reply on Oct 23, 2007 3:18 PM by mdjportfolio

    conflict with multiple if statements

    mdjportfolio
      newbie to actionscript (1.0) , I have a event calendar that I'm trying to modify. (It pulls messages from an XML file) Currently the calendar has three states for the day blocks ( ie. 1st , 2nd , etc) One for a day with no event, one for the current day and one for a day with an event. I'm trying to make the day blocks have different colors based on the type of event (7 different types). I have added 7 additional frames to the "numbers" (day block) movie file with different colors. I tried to duplicate the if statement that would check if the a particular day had an event (by checking for "date" in the XML file) and tell it to go to frame 3 (the state in "Numbers" that specifies a day with an event). I duplicated it and changed it to check for "date_conf" in the XML file and take it to frame 4. It works fine except that it will not allow more than one event for "date" or "date_conf". Is there a better way to do this (I'm sure) or how can I do multiple if statements without causing the conflict? Thanks!

      Code below is what I'm editing:

      {
      arrDate = arrCal .childNodes;
      for (j=0; j<=arrDate.length; j++) {
      if (arrDate[j].nodeName == "date") {
      diaryDate = arrDate[j].attributes.id;
      myDiary = _root["Numbers" + diaryDate];
      myDiary.gotoAndStop (3);
      arrMsg = arrDate[j].childNodes;
      for (k=0; k<=arrMsg.length; k++) {
      if (arrMsg[k].nodeName == "msg")

      {
      arrDate = arrCal
      .childNodes;
      for (j=0; j<=arrDate.length; j++) {
      if (arrDate[j].nodeName == "date_conf") {
      diaryDate = arrDate[j].attributes.id;
      myDiary = _root["Numbers" + diaryDate];
      myDiary.gotoAndStop (3);
      arrMsg = arrDate[j].childNodes;
      for (k=0; k<=arrMsg.length; k++) {
      if (arrMsg[k].nodeName == "msg")


      Full script here:
      XMLData = new XML();
      XMLData.load("cal.xml");
      XMLData.onload = viewApp;
      function viewApp () {
      mainTag = new XML();
      arrCal = new Array();
      arrDate = new Array();
      arrMsg = new Array();
      mainTag = this.firstChild.nextSibling;
      if (mainTag.nodeName.toLowerCase() == "diary") {
      arrCal = mainTag.childNodes;
      for (i=0; i<=arrCal.length; i++) {
      if (arrCal .nodeName == "cal") {
      if ((arrCal
      .attributes.yearID == myNewYear) and (arrCal .attributes.monthID == myNewMonth)) {
      arrDate = arrCal
      .childNodes;
      for (j=0; j<=arrDate.length; j++) {
      if (arrDate[j].nodeName == "date") {
      diaryDate = arrDate[j].attributes.id;
      myDiary = _root["Numbers" + diaryDate];
      myDiary.gotoAndStop (3);
      arrMsg = arrDate[j].childNodes;
      for (k=0; k<=arrMsg.length; k++) {
      if (arrMsg[k].nodeName == "msg")

      {
      arrDate = arrCal .childNodes;
      for (j=0; j<=arrDate.length; j++) {
      if (arrDate[j].nodeName == "date_conf") {
      diaryDate = arrDate[j].attributes.id;
      myDiary = _root["Numbers" + diaryDate];
      myDiary.gotoAndStop (3);
      arrMsg = arrDate[j].childNodes;
      for (k=0; k<=arrMsg.length; k++) {
      if (arrMsg[k].nodeName == "msg")


      {
      }
      }
      }
      }
      }
      }
      }
      }
      }
      }
      }
      }
      }