Search Flex Components Free

Custom Search
Showing posts with label Flex DateChooser Examples. Show all posts
Showing posts with label Flex DateChooser Examples. Show all posts

January 23, 2008

Embedding fonts for the Flex DateField control

The following example shows how you can embed fonts for use with the DateField control in Flex. Note that we embed both the normal and bold font weights since by default the month and year are bold in the DateChooser sub-component.




<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

layout="vertical"

verticalAlign="top"

backgroundColor="white">



<mx:Style>

@font-face {

src: local("Comic Sans MS");

fontFamily: "ComicEmbedded";

fontWeight: normal;

unicode-range: U+0030-U+0039, /* 0-9 */

U+002F-U+002F; /* slash (/) */

}



@font-face {

src: local("Comic Sans MS");

fontFamily: "ComicEmbedded";

fontWeight: bold;

unicode-range:

U+0030-U+0039, /* 0-9 */

U+0041-U+0051, /* Uppercase A-Z */

U+0052-U+007A; /* Lowercase a-z */

}

</mx:Style>

<mx:DateField id="dateField"

fontFamily="ComicEmbedded"

color="red" />

</mx:Application>

January 14, 2008

Customizing the Flex DateChooser control

The following example shows how you can customize the DateChooser control in Flex by using an embedded font, customizing the header styles, week day names, week day name styles, and colors by setting various styles and properties.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
<mx:Style>
@font-face { src: local("Base 02");
fontFamily: Base02Embedded; unicode-range: U+0030-U+0039,
/* 0-9 */ U+0041-U+0051, /* Uppercase A-Z */ U+0052-U+007A, /* Lowercase a-z */ U+002F-U+002F; /* slash (/) */
} DateChooser
{ cornerRadius: 0;
/* pixels */ header
Colors: black, black; borderColor: black; themeColor: black; fontFamily:
Base02Embedded; todayColor: red;
todayStyleName: myTodayStyleName; headerStyleName: myHeaderStyleName;
weekDayStyleName: myWeekDayStyleName; dropShadowEnabled: true;
}
.myTodayStyleName
{
color: white;
}
.myWeekDayStyleName { fontWeight: normal; }
.myHeaderStyleName { color: red; fontSize: 16; fontWeight: normal; }
</mx:Style>
<mx:Script>
<![CDATA[ import mx.formatters.DateBase; private function dateChooser_init():void
{ dateChooser.dayNames = DateBase.dayNamesShort; }
]]>

</mx:Script>
<mx:DateChooser id="dateChooser" initialize="dateChooser_init();" />
</mx:Application>

Related Flex Tutorials