I guess this works:
var my_date:Date = new Date();
var dia:Date = new Date(my_date.fullYear,my_date.month,my_date.date);
//var dia:Date = new Date(2010,05,06);
var nowEvent1:Date = new Date(2010,04,30);
var nowEvent2:Date = new Date(2010,05,02);
var nowEvent3:Date = new Date(2010,05,05);
var nowEvent4:Date = new Date(2010,05,06);
var eventArray:Array = [nowEvent1,nowEvent2,nowEvent3,nowEvent4];
for (var i:int; i < eventArray.length; i++) {
if (eventArray[i] >= dia) {
trace(eventArray[i]);
return;
}
}
It's just a sample with hardcoded values (because the XML code is too big) but it seems to be working. Changing the "dia" variable returns the correct up coming event date.
In my code I get the current date from a flashvar setted by PHP and then convert it to a date object in flash.
I can post the whole code if someone's interested. And I'm oppened to a better way too!