3

I need a time chooser for a flex app, and as far as I can tell there is no UI component to manipulate Date objects at a resolution finer than per-day (the DateChooser component).

What's a good time chooser for Flex? I strongly prefer a Free as in Libre and/or Free as in Beer component.

Chris R
  • 17,546
  • 23
  • 105
  • 172

6 Answers6

5

Maybe this could help: http://blog.georg-graf.com/archives/301

e kn
  • 66
  • 1
  • 1
4

This should work for you: http://joelhooks.com/2008/10/11/flex-date-and-time-datetime-picker-control/

There's a demo and a link to the source code right above it.

Chris R
  • 17,546
  • 23
  • 105
  • 172
Alex Jillard
  • 2,792
  • 2
  • 19
  • 20
  • Thank you. That's the one I'm currently using, but I'm not terrifically happy with it. It does, however, work. So if nobody has a better one I'll be marking this as the accepted sometime soon. – Chris R Sep 16 '09 at 20:47
2

If you want to only edit the time, here a solution :

http://weflex.wordpress.com/2011/02/17/flex-timeinput-component/

kamelito
  • 31
  • 3
1

Found this on Adobe site (first result in Google hunt) http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1400019.

You could extend the DateChooser component to add above feature.

Satish
  • 6,457
  • 8
  • 43
  • 63
1

The Yahoo! Astra TimeInput and TimeStepper are useful.

http://developer.yahoo.com/flash/astra-flex/timeinput/

http://developer.yahoo.com/flash/astra-flex/timestepper/

However, apparently there is an issue when using them with the Flex 4 SDK and it seems Yahoo! currently has no plans to update their Astra components.

You may want to check out this link for a version that works with Flex 4. https://github.com/joshtynjala/astra-flex

I think a time input would be a good candidate for a native Flex SDK component.

Jamie McDaniel
  • 1,809
  • 19
  • 15
0

Try this following Code: This will be useful to input HH:MM 12hr format without AM/PM

MXML code:

<Timepicker maxChars="5" restrict="0-9" />

ActionScript code:

package
{
import flash.events.KeyboardEvent;

import mx.controls.TextInput;

public class Timepicker extends TextInput
{
    public function Timepicker()
    {
    }

    override protected function keyUpHandler(event:KeyboardEvent):void
    {
        super.keyUpHandler(event);

        if (text.length == 0)
        {
            return;
        }
        var keyDel:Boolean=false;
        if (event.charCode == 8 || event.charCode == 46)
            keyDel=true;
        var numberString:String=text;
        if (keyDel)
            text=numberString;

        if (numberString.length > 0 && !keyDel)
        {
            if (numberString.length == 2 && numberString.indexOf(":") == -1)
            {
                text=numberString;
                textField.appendText(":");
            }
            else if (numberString.length >= 4 && Number(numberString.charAt(3)) > 5)
            {
                text=numberString.substr(0, 3)
            }
            else if (numberString.length == 3 && numberString.charAt(2) != ":")
            {
                if (Number(numberString.charAt(2)) <= 5)
                {
                    var fourthDigit:String=numberString.charAt(2);
                    super.textField.text="";
                    super.textField.appendText(numberString.substring(0, 2) + ":" + fourthDigit);
                }
                else
                {
                    super.textField.text="";
                    super.textField.appendText(numberString.substring(0, 2) + ":");
                }
            }
            textField.setSelection(textField.length, textField.length);

        }
    }

    override protected function keyDownHandler(event:KeyboardEvent):void
    {
        super.keyDownHandler(event);
        var keyDel:Boolean=false;
        if (event.charCode == 8 || event.charCode == 46)
            keyDel=true;

        super.text=text;
        if (super.text.length == 0)
        {
            var inputVal:String=String.fromCharCode(event.charCode);
            if (Number(inputVal) > 1)
            {
                super.textField.appendText("0" + inputVal + ":");
            }
        }
        super.textField.setSelection(super.textField.length, super.textField.length);
    }

}

}

Aabaa
  • 46
  • 2