Tuesday, 8 May 2007

Open Source TimePicker control for Flex

« James Ward's Google talk on Flex/Flash/Apollo | Main | Dive Into Mark on Adobe Apollo »

I needed a TimePicker in Flex 2 in order to help fix a few problems in the Meldware WebMail Client's calendar. I found one that was supposed to be on Adobe's site, but the page was broken. I found another for Flex 1.5 but it also didn't handle a 24 hour clock and had lots of minor issues even when I made it run on Flex 2. So I made my own:

click here to see it

I released it under LGPL/MPL 1.1 or whatever version of MPL the Flex SDK is released under proivded there are no amendments (ala Exhibit B). You can check the source out from here (instructions here). You can download a compiled version here by right clicking save as. You can also see it in action here. Click on the Event Editor Screen.

I've included usage instructions at the top of the main source file. I do not do asDoc as it does not run on Linux and is therefore not relevant to me at all. Basically this is the MXML:

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
	xmlns:buni="http://www.buni.org/flex/controls/qsimport" 
	maxWidth="{this.width}" horizontalScrollPolicy="off">
...
		<buni:TimePicker id="mytime" twelveHour="true" 
                                    hour="12" minutes="0" meridian="AM" 
                                    onChange="changed()"/>

The build can look like something like this (the important part is the timepicker.swc):

  <target name="flexExists" depends="flex-uptodate"
      if="flex.exists" unless="hello.uptodate">
    <java  jar="${flex.sdk.dir}/lib/mxmlc.jar" fork="true" 
           failonerror="true" maxmemory="128m">
      <jvmarg value="-Dapplication.home=${flex.sdk.dir}"/>
      <arg value="-file-specs" />
      <arg value="${flex.src.dir}/freebusy.mxml" />
      <arg value="-compiler.include-libraries" />
      <arg value="${lib.dir}/Cairngorm.swc" />
      <arg value="${lib.dir}/timepicker.swc" />
      <arg value="-debug=true"/>
      <arg value="-output" />
      <arg value="${flex.build.dir}/freebusy.swf" />
    </java>
  </target>

If you want to build the component you need a recent version of Apache Ant and Flex 2.1 of course. Set the FLEX_HOME environment parameter to your main Flex SDK directory. If you need a hand you can ask on the Meldware development mail list. I'll put out a build from time to time and continue to enhance it as we need.

Technorati Tags:

Posted by acoliver at 2:14 PM in Open Source

 

[Trackback URL for this entry]

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
« May »
SunMonTueWedThuFriSat
  12345
6789101112
13141516171819
20212223242526
2728293031