Hi,
I'm using a datefield component Flash 8 and want to disable dates from an external xml file created from a mysql db.The two instances are instantiated from the library. Trace of the disabled date array is: {rangeStart: new Date(2008,2,6), rangeEnd: new Date(2008,7,3)},{rangeStart: new Date(2008,7,3), rangeEnd: new Date(2008,7,7)},{rangeStart: new Date(2007,6,5), rangeEnd: new Date(2007,8,7)},{rangeStart: new Date(2007,9,8), rangeEnd: new Date(2007,11,10)}

The AS is as follows:
stop();
var daysIn:Array = new Array();
var monthsIn:Array = new Array();
var yearsIn:Array = new Array();
var daysOut:Array = new Array();
var monthsOut:Array = new Array();
var yearsOut:Array = new Array();
var allData:Array = [];
myXml_xml = new XML();
myXml_xml.ignoreWhite = true;
myXml_xml.onLoad = function(ok) {
   if (ok) {
       allData = myXml_xml.firstChild.childNodes;
       //trace(allData);
       var i = 0;
       do {
           //create dates sub arrays
           daysIn.push(allData[i].firstChild.firstChild);
           monthsIn.push(allData[i].firstChild.nextSibling.firstChild);
yearsIn.push(allData[i].firstChild.nextSibling.nextSibling.firstChild); daysOut.push(allData[i].firstChild.nextSibling.nextSibling.nextSibling.firstChild); monthsOut.push(allData[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firstChild); yearsOut.push(allData[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild);
           i++;
       } while (i<allData.length);
   }
   var disabledDates:Array = new Array();
   var f = 0;
   do {
       //create Array of disabled dates
disabledDates.push('{rangeStart: new Date('+yearsIn[f]+','+monthsIn[f]+','+daysIn[f]+'), rangeEnd: new Date('+yearsOut[f]+','+monthsOut[f]+','+daysOut[f]+')}');
       f++;
   } while (f<daysIn.length);
   //create datefields
   _root.createClassObject(mx.controls.DateField, "in_df", 1);
   in_df._x = 100;
   in_df._y = 50;
   _root.createClassObject(mx.controls.DateField, "out_df", 2);
   out_df._x = 100;
   out_df._y = 150;
   // load disabled dates into datiefields
   in_df.disabledRanges = [disabledDates];
   out_df.disabledRanges = [disabledDates];
   trace(disabledDates);
};
myXml_xml.load('results03.xml');

It just doesn't disable anything.

Thanks, JD
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to