Time Selection Example In Flex ( Time Picker )

There is no time selection control available in flex, in this example we use a simple FLEX TextInput to create a Time Selection Control.


<?xml version="1.0" encoding="utf-8"?>

[Event(name="timeChange")]

=0 && minutes<=59 && hours>=0 && hours<=23 ){

if(hours>_minHour || (hours==_minHour && minutes>_minMinute)){
_minutes = minutes;
_hours = hours;
ok = true;
dispatchEvent(new Event("timeChange"));
}
else{
var nextMin:Number = _minMinute+1;
var nextHour:Number = _minHour;
if(nextMin>59){
nextHour++;
nextMin=0;
}
var aDate:Date = new Date();
aDate.hours = nextHour;
aDate.minutes = nextMin;

var formatedDate:String = dateFormater.format(aDate);
errorStr = "Minimum time is " +formatedDate;
}
}
}
}
if(ok){
errorString = "";
}
else{
errorString = errorStr;
}
}
}
]]>

You can see a complete source attached