<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; firstDayOfWeek</title>
	<atom:link href="http://blog.flexexamples.com/tag/firstdayofweek/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting the first day of the week in a Flex DateField control&#8217;s calendar</title>
		<link>http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/</link>
		<comments>http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 07:11:31 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateBase]]></category>
		<category><![CDATA[DateField]]></category>
		<category><![CDATA[dayNamesShort]]></category>
		<category><![CDATA[firstDayOfWeek]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/</guid>
		<description><![CDATA[<p>The following example shows how you can set the firstDayOfWeek property on the Flex DateField control to control whether the pop-up calendar starts on a Sunday (default) or a different day of the week.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_firstDayOfWeek_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the <code>firstDayOfWeek</code> property on the Flex DateField control to control whether the pop-up calendar starts on a Sunday (default) or a different day of the week.</p>
<p>Full code after the jump.</p>
<p><span id="more-389"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_firstDayOfWeek_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;
            import mx.formatters.DateBase;

            private function dateField_labelFunc(item:Date):String {
                return dateFormatter.format(item);
            }

            private function slider_change(evt:SliderEvent):void {
                dateField.firstDayOfWeek = evt.value;
                dateField.open();
            }

            private function slider_dataTipFunc(value:Number):String {
                return DateBase.dayNamesShort[value];
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateFormatter id="dateFormatter" formatString="MMM D, YYYY"/&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="firstDayOfWeek:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="6"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="1"
                        dataTipFormatFunction="slider_dataTipFunc"
                        change="slider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DateField id="dateField"
            labelFunction="dateField_labelFunc"
            firstDayOfWeek="{Days.MONDAY}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_firstDayOfWeek_test/Days.as">View Days.as</a></p>
<pre class="code">
package {
    public class Days {
        public static const SUNDAY:uint = 0;
        public static const MONDAY:uint = 1;
        public static const TUESDAY:uint = 2;
        public static const WEDNESDAY:uint = 3;
        public static const THURSDAY:uint = 4;
        public static const FRIDAY:uint = 5;
        public static const SATURDAY:uint = 6;

        public function Days() {
        }
    }
}
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_firstDayOfWeek_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateField_firstDayOfWeek_test/bin/main.html" width="100%" height="300"></iframe></p>
<p>For other examples of setting the <code>firstDayOfWeek</code> property (mainly for the DateChooser control), see <a href="http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/">&#8220;Setting the DateChooser control&#8217;s dayNames property and firstDayOfWeek property&#8221;</a> and <a href="http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/">&#8220;Changing the calendar layout in the DateChooser component using the firstDayOfWeek parameter&#8221;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the first day of the week in a Flex DateField control\&#039;s calendar on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/',contentID: 'post-389',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dayNamesShort,firstDayOfWeek',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/12/20/setting-the-first-day-of-the-week-in-a-flex-datefield-controls-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the DateChooser control&#8217;s dayNames property and firstDayOfWeek property</title>
		<link>http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/</link>
		<comments>http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 05:59:18 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateBase]]></category>
		<category><![CDATA[DateChooser]]></category>
		<category><![CDATA[DateField]]></category>
		<category><![CDATA[dayNames]]></category>
		<category><![CDATA[dayNamesLong]]></category>
		<category><![CDATA[dayNamesShort]]></category>
		<category><![CDATA[firstDayOfWeek]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/</guid>
		<description><![CDATA[<p>This is kind of silly, but I was looking through the DateBase class today and figured &#8220;why not?&#8221;. This example takes a quick look at setting the DateChooser control&#8217;s dayNames property and switching between the default values (&#8220;S&#8221;, &#8220;M&#8221;, &#8220;T&#8221;, &#8230;, &#8220;S&#8221;) with the longer versions such as &#8220;Sun&#8221;, &#8220;Mon&#8221;, &#8220;Tue&#8221;, &#8230;, &#8220;Sat&#8221;, and the [...]]]></description>
			<content:encoded><![CDATA[<p>This is kind of silly, but I was looking through the DateBase class today and figured &#8220;why not?&#8221;. This example takes a quick look at setting the DateChooser control&#8217;s <code>dayNames</code> property and switching between the default values (&#8220;S&#8221;, &#8220;M&#8221;, &#8220;T&#8221;, &#8230;, &#8220;S&#8221;) with the longer versions such as &#8220;Sun&#8221;, &#8220;Mon&#8221;, &#8220;Tue&#8221;, &#8230;, &#8220;Sat&#8221;, and the longer/sillier still &#8220;Sunday&#8221;, &#8220;Monday&#8221;, &#8220;Tuesday&#8221;, &#8230;, &#8220;Saturday&#8221;.</p>
<p>The one interesting thing to note in this example though, is even though you can change the <code>firstDayOfWeek</code> property to control the day first of the week that the calendar starts on, the <code>dayNames</code> array should always start with Sunday.</p>
<p>Full code after the jump.</p>
<p><span id="more-116"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateChooser_dayNames_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init()"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.formatters.DateBase;

            [Bindable]
            private var dayNamesDefaultArr:Array;

            [Bindable]
            private var dayNamesShortArr:Array = DateBase.dayNamesShort;

            [Bindable]
            private var dayNamesLongArr:Array = DateBase.dayNamesLong;

            private function init():void {
                dayNamesDefaultArr = dateChooser.dayNames;
            }

            private function slider_dataTipFormatFunc(item:Object):String {
                return dateChooser.dayNames[slider.value];
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="dayNamesArr"&gt;&lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label text="dayNames:" /&gt;
        &lt;mx:ComboBox id="comboBox"
                change="dateChooser.dayNames = comboBox.selectedItem.data"&gt;
            &lt;mx:dataProvider&gt;
                &lt;mx:Array&gt;
                    &lt;mx:Object label="default" data="{dayNamesDefaultArr}" /&gt;
                    &lt;mx:Object label="short" data="{dayNamesShortArr}" /&gt;
                    &lt;mx:Object label="long" data="{dayNamesLongArr}" /&gt;
                &lt;/mx:Array&gt;
            &lt;/mx:dataProvider&gt;
        &lt;/mx:ComboBox&gt;

        &lt;mx:Spacer width="100%" /&gt;

        &lt;mx:Label text="firstDayOfWeek:" /&gt;
        &lt;mx:HSlider id="slider"
                minimum="0"
                maximum="6"
                liveDragging="true"
                snapInterval="1"
                dataTipFormatFunction="slider_dataTipFormatFunc" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DateChooser id="dateChooser" firstDayOfWeek="{slider.value}" /&gt;

    &lt;mx:Label text="{dateChooser.dayNames.join(', ')}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateChooser_dayNames_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateChooser_dayNames_test/bin/main.html" width="100%" height="350"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the DateChooser control\&#039;s dayNames property and firstDayOfWeek property on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/',contentID: 'post-116',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dayNames,dayNamesLong,dayNamesShort,firstDayOfWeek',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/08/23/setting-the-datechooser-controls-daynames-property-and-firstdayofweek-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formatting dates using the DateFormatter</title>
		<link>http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/</link>
		<comments>http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 05:11:47 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateField]]></category>
		<category><![CDATA[DateFormatter]]></category>
		<category><![CDATA[firstDayOfWeek]]></category>
		<category><![CDATA[labelFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/</guid>
		<description><![CDATA[<p>Another basic little example showing how to format the text in a DateField control using the DateFormatter and the DateField control&#8217;s labelFunction property. This entry also shows the pretty basic trick of creating a separate ActionScript class file that holds the day names as constants so you don&#8217;t constantly have to think whether Monday is [...]]]></description>
			<content:encoded><![CDATA[<p>Another basic little example showing how to format the text in a DateField control using the DateFormatter and the DateField control&#8217;s <code>labelFunction</code> property. This entry also shows the pretty basic trick of creating a separate ActionScript class file that holds the day names as constants so you don&#8217;t constantly have to think whether Monday is day 0 or day 1 (hint: it is day 1).</p>
<p>Full code after the jump.</p>
<p><span id="more-41"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function doLabel(item:Date):String {
                return dateFormatter.format(item);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateFormatter id="dateFormatter" formatString="MMM D, YYYY"/&gt;

    &lt;mx:DateField todayColor="red" labelFunction="doLabel" firstDayOfWeek="{Days.MONDAY}" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information">Days.as</p>
<pre class="code">
// ActionScript file
package {
    public class Days {
        public static const SUNDAY:uint = 0;
        public static const MONDAY:uint = 1;
        public static const TUESDAY:uint = 2;
        public static const WEDNESDAY:uint = 3;
        public static const THURSDAY:uint = 4;
        public static const FRIDAY:uint = 5;
        public static const SATURDAY:uint = 6;
    }
}
</pre>
<p class="information">View source enabled in the following example</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateField_labelFunction_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Formatting dates using the DateFormatter on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/',contentID: 'post-41',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'firstDayOfWeek,labelFunction',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/07/30/formatting-dates-using-the-dateformatter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Changing the calendar layout in the DateChooser component using the firstDayOfWeek parameter</title>
		<link>http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/</link>
		<comments>http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 04:41:59 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateChooser]]></category>
		<category><![CDATA[firstDayOfWeek]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/</guid>
		<description><![CDATA[<p>A brief example of changing the first day of the week for the DateChooser control using the firstDayOfWeek property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateChooser_firstDayOfWeek_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ private var dayNames:Array = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; private function getDayName(item:Number):String { return [...]]]></description>
			<content:encoded><![CDATA[<p>A brief example of changing the first day of the week for the DateChooser control using the <code>firstDayOfWeek</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-40"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateChooser_firstDayOfWeek_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private var dayNames:Array = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

            private function getDayName(item:Number):String {
                return dayNames[item];
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateChooser todayColor="red" firstDayOfWeek="{slider.value}"/&gt;

    &lt;mx:VBox&gt;
        &lt;mx:Label text="First day of week:" /&gt;
        &lt;mx:HSlider id="slider" minimum="0" maximum="6" liveDragging="true" snapInterval="1" dataTipFormatFunction="getDayName" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information">View source enabled in the following example</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DateChooser_firstDayOfWeek_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the calendar layout in the DateChooser component using the firstDayOfWeek parameter on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/',contentID: 'post-40',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'firstDayOfWeek',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/07/30/changing-the-calendar-layout-in-the-datechooser-component-using-the-firstdayofweek-parameter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

