topical media & game development

talk show tell print

professional-flex-code-12-AdvancedMonths.mx

professional-flex-code-12-AdvancedMonths.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" 
      creationComplete="init()"
      dataProvider="{this.months}" 
      labelField="{this.labelFieldVar}">
    <mx:Script>
        <![CDATA[
           [Bindable]
           private var months:Array = [{full:"January",abr:"Jan",num:1},
                      {full:"February",abr:"Feb",num:2},
                      {full:"March",abr:"Mar",num:3},
                      {full:"April",abr:"Apr",num:4},
                      {full:"May",abr:"May",num:5},
                      {full:"June",abr:"Jun",num:6},
                      {full:"July",abr:"Jul",num:7},
                      {full:"August",abr:"Aug",num:8},
                      {full:"September",abr:"Sep",num:9},
                      {full:"October",abr:"Oct",num:10},
                      {full:"November",abr:"Nov",num:11},
                      {full:"December",abr:"Dec",num:12}]; 
           [Bindable]
           [Inspectable(defaultValue="full", enumeration="full,abr,num")]
           public var labelFieldVar:String = "full";
           
           public function getSelectedMonth(s:String):String{
               return "You have selected "+this.selectedItem[s];
           }
        ]]>
    </mx:Script>
  </mx:ComboBox>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.