September 2nd, 2008 by Kyle
Tags: as3, calendar, calendar control, datechooser, Flex
Posted in: ActionScript, Flex
I had someone ask me a while back how they could set the background color for the “SMTWTFS header” in the calendar control. This is not built in functionality, but really not that hard to do.
In fact, I found 2 different approaches. The first is below, the second, I will post in a few days after I clean up the code a bit.
(I would like to point out that this is just an approach and may not be production ready code.)
Download a zipfile containing the source to this sample.
Browse the source of this example.
Or continue into the blog entry to see the source:
Here is the app code:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*" viewSourceURL="srcview/index.html">
<MyDC id="myDC"/>
</mx:Application>
Here is the code for the custom component:
<mx:DateChooser xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.core.UITextField;
import mx.core.mx_internal;
use namespace mx_internal;
override protected function createChildren():void{
super.createChildren();
for(var i:int=0;i <7;i++){
var foo:UITextField = mx_internal::dateGrid.dayBlocksArray[i][0] as UITextField;
foo.background=true;
foo.backgroundColor=0xDDDDDD;
}
}
]]>
</mx:Script>
</mx:DateChooser>











September 4th, 2008 at 7:24 am
[...] http://blog.flexmonkeypatches.com/2008/09/02/flex-datechooser-background-color-for-smtwtfs-header-so... [...]