<?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; dayNamesLong</title>
	<atom:link href="http://blog.flexexamples.com/tag/daynameslong/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>Using the DateBase class in Flex</title>
		<link>http://blog.flexexamples.com/2007/12/11/using-the-datebase-class-in-flex/</link>
		<comments>http://blog.flexexamples.com/2007/12/11/using-the-datebase-class-in-flex/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 06:53:00 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DateBase]]></category>
		<category><![CDATA[DateChooser]]></category>
		<category><![CDATA[dayNamesLong]]></category>
		<category><![CDATA[dayNamesShort]]></category>
		<category><![CDATA[monthNamesLong]]></category>
		<category><![CDATA[monthNamesShort]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/11/using-the-datebase-class-in-flex/</guid>
		<description><![CDATA[<p>We&#8217;ve looked briefly at the DateBase class before, <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>, but considering how often dates/calendars come up in Flex, it is always good to remind people that they don&#8217;t need to reinvent the wheel (or date constants, as the case may be).</p> <p>The following examples shows how [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve looked briefly at the DateBase class before, <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>, but considering how often dates/calendars come up in Flex, it is always good to remind people that they don&#8217;t need to reinvent the wheel (or date constants, as the case may be).</p>
<p>The following examples shows how you can use the various static properties in the DateBase class (shown below) to populate ComboBox controls (or any other control with a data provider).</p>
<ul>
<li><code>dayNamesShort</code> &#8212; &#8220;Sun&#8221;, &#8230;, &#8220;Sat&#8221;</li>
<li><code>dayNamesLong</code> &#8212; &#8220;Sunday&#8221;, &#8230;, &#8220;Saturday&#8221;</li>
<li><code>monthNamesShort</code> &#8212; &#8220;Jan&#8221;, &#8230;, &#8220;Dec&#8221;</li>
<li><code>monthNamesLong</code> &#8212; &#8220;January&#8221;, &#8230;, &#8220;December&#8221;</li>
<li><code>timeOfDay</code> &#8212; &#8220;AM&#8221;, &#8220;PM&#8221;</li>
</ul>
<p>Full code after the jump.</p>
<p><span id="more-360"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateBase_dayNamesShort_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/11/using-the-datebase-class-in-flex/ --&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.collections.ArrayCollection;
            import mx.formatters.DateBase;

            private function init():void {
                comboBox1.dataProvider = new ArrayCollection(DateBase.dayNamesShort);
                comboBox2.dataProvider = new ArrayCollection(DateBase.dayNamesLong);
                comboBox3.dataProvider = new ArrayCollection(DateBase.monthNamesShort);
                comboBox4.dataProvider = new ArrayCollection(DateBase.monthNamesLong);
                comboBox5.dataProvider = new ArrayCollection(DateBase.timeOfDay);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Form creationComplete="init();"&gt;
        &lt;mx:FormItem label="DateBase.dayNamesShort:"&gt;
            &lt;mx:ComboBox id="comboBox1" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="DateBase.dayNamesLong:"&gt;
            &lt;mx:ComboBox id="comboBox2" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="DateBase.monthNamesShort:"&gt;
            &lt;mx:ComboBox id="comboBox3" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="DateBase.monthNamesLong:"&gt;
            &lt;mx:ComboBox id="comboBox4" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="DateBase.timeOfDay:"&gt;
            &lt;mx:ComboBox id="comboBox5" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateBase_dayNamesShort_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/DateBase_dayNamesShort_test/bin/main.html" width="100%" height="300"></iframe></p>
<p>Also, remember that each of these values are read-write, so if you want to localize the values to other languages, you can easily pass a new Array and overwrite the old values, as shown in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DateBase_dayNamesLong_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/11/using-the-datebase-class-in-flex/ --&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[
            import mx.formatters.DateBase;

            DateBase.monthNamesLong = ["janvier",
                                        "février",
                                        "mars",
                                        "avril",
                                        "mai",
                                        "juin",
                                        "juillet",
                                        "août",
                                        "septembre",
                                        "octobre",
                                        "novembre",
                                        "décembre"];
            DateBase.dayNamesLong = ["dimanche",
                                        "lundi",
                                        "mardi",
                                        "mercredi",
                                        "jeudi",
                                        "vendredi",
                                        "samedi"];

            private function init():void {
                dateChooser.selectedDate = new Date();
                dateChooser.monthNames = DateBase.monthNamesLong;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateFormatter id="dateFormatter"
            formatString="EEEE MMMM-DD-YYYY" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label id="lbl"
                text="{dateFormatter.format(dateChooser.selectedDate)}"
                textAlign="center"
                fontSize="24"
                selectable="true"
                width="100%" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:DateChooser id="dateChooser"
            creationComplete="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DateBase_dayNamesLong_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/DateBase_dayNamesLong_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using the DateBase class in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/12/11/using-the-datebase-class-in-flex/',contentID: 'post-360',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dayNamesLong,dayNamesShort,monthNamesLong,monthNamesShort',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/11/using-the-datebase-class-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</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>
	</channel>
</rss>

