a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADOBE SYSTEMS INCORPORATED
|
||||
// Copyright 2007 Adobe Systems Incorporated
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
|
||||
// terms of the Adobe license agreement accompanying it. If you have received this file from a
|
||||
// source other than Adobe, then your use, modification, or distribution of it requires the prior
|
||||
// written permission of Adobe.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-->
|
||||
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
xmlns:me="components.*"
|
||||
creationComplete="init()">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
|
||||
//create bindable variables to share with components
|
||||
[Bindable]
|
||||
private var days:Array = new Array();
|
||||
|
||||
[Bindable]
|
||||
private var years:Array = new Array();
|
||||
|
||||
private function init():void{
|
||||
|
||||
//get current date
|
||||
var now:Date = new Date();
|
||||
|
||||
//populate day array
|
||||
for(var i:int=1; i<=31; i++){
|
||||
this.days.push(i);
|
||||
}
|
||||
//populate the years array up to the current year
|
||||
for(var j:int=1950; j<=now.getFullYear(); j++){
|
||||
this.years.push(j);
|
||||
}
|
||||
|
||||
//select the display values for the combo boxes based on the current date
|
||||
this.daysCB.selectedIndex = days.indexOf(now.getDate());
|
||||
this.yearsCB.selectedIndex = years.indexOf(now.getFullYear());
|
||||
}
|
||||
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<me:ComboBoxMonths id="monthsCB"/>
|
||||
<mx:ComboBox id="daysCB" dataProvider="{this.days}" width="50"/>
|
||||
<mx:ComboBox id="yearsCB" dataProvider="{this.years}" width="65"/>
|
||||
</mx:HBox>
|
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ADOBE SYSTEMS INCORPORATED
|
||||
// Copyright 2007 Adobe Systems Incorporated
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
|
||||
// terms of the Adobe license agreement accompanying it. If you have received this file from a
|
||||
// source other than Adobe, then your use, modification, or distribution of it requires the prior
|
||||
// written permission of Adobe.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
-->
|
||||
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.formatters.DateFormatter;
|
||||
|
||||
//variable does not need to be bindable since it is not shared or changed after creation.
|
||||
private var months:Array = new Array();
|
||||
private var dateformatter:DateFormatter = new DateFormatter();
|
||||
|
||||
private function init():void{
|
||||
var i:int;
|
||||
//get the date
|
||||
var now:Date = new Date();
|
||||
//set current month
|
||||
var currentMonth:int = now.getMonth();
|
||||
//format the string to show only the month
|
||||
dateformatter.formatString = "MMMM";
|
||||
|
||||
//loop 12 times
|
||||
for (i=0; i<12; i++){
|
||||
//change the month of the date
|
||||
now.setMonth(i);
|
||||
//poplate the array with the month string
|
||||
months[i] = dateformatter.format(now);
|
||||
}
|
||||
|
||||
//set the array as the dataprovider of this combobox
|
||||
this.dataProvider = months;
|
||||
//select current month
|
||||
this.selectedIndex = currentMonth;
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
</mx:ComboBox>
|
||||
|
Reference in New Issue
Block a user