Is there any Flex control to select months (any)?
Right now I'm using a DateField, and allow the user to select any date in a month to select that month.
Is there any Flex control to select months (any)?
Right now I'm using a DateField, and allow the user to select any date in a month to select that month.
Maybe try ComboBox? or List?
So here is the sample with ComboBox:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:controls="radekg.*">
<mx:Form>
<mx:FormItem label="Select date:">
<controls:DateComboBox id="dcb" change="trace(dcb.selectedMonth)" />
</mx:FormItem>
</mx:Form>
</mx:WindowedApplication>
And radekg/DateComboBox.as
package radekg {
import mx.collections.ArrayCollection;
import mx.controls.ComboBox;
import mx.formatters.DateFormatter;
public class DateComboBox extends ComboBox {
public function DateComboBox() {
super();
var formatter:DateFormatter = new DateFormatter();
formatter.formatString = "MMMM";
dataProvider = new ArrayCollection();
for (var i:int=0; i<12; i++) {
var date:Date = new Date(1971,i,1);
ArrayCollection(dataProvider).addItem(
{ label: formatter.format(date), data: date }
);
}
selectedIndex = 0;
}
public function get selectedMonth():Number {
return (selectedItem.data as Date).month;
}
public function set selectedMonth(value:Number):void {
selectedIndex = value;
}
}
}
It is just a sample :) Hope it helps.