Get more control over the Flex DateField component

I really messed up with the standard Flex DateField component trying to get rid of this annoying text field left to the date icon. In my opinion Flex gives you too less control over all of the in a DateField included components. There is no attribute or style available to hide the TextInput field.

But fortunately it’s very easy to extend Flex components. For a project I was working I pragmatically turned off the visibility of the input field by making the TextInput field child object accessible to the outer world by adding a getter and a setter method for the ComboBase textField class property. This gives us full control over the input field. Instead of just turning visibility off you can of change other properties as the width or height.

The actionscript extension class (

package customComponents


import mx.controls.DateField;

import mx.controls.TextInput;

public class DateChooserPopup extends DateField


public function DateChooserPopup()




public function set TextInputField( textInput:TextInput ):void {

this.textInput = textInput;


public function get TextInputField():TextInput {

return this.textInput;




Now we use the new component within the MXML main file:

<?xml version=“1.0″ encoding=“utf-8″?>

<mx:Application xmlns:mx=““ width=“640“ height=“445“ layout=“absolute“ backgroundGradientColors=“[#FFFFFF, #FFFFFF]“ xmlns:CUSTComp=“customComponents.*>

<CUSTComp:DateChooserPopup creationComplete=“this.TextInputField.visible=false“ />


Einen Kommentar hinterlassen

Ihre E-Mail wird niemals veröffentlicht oder weitergegeben. Erforderliche Felder sind mit * markiert

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Ich stimme der Datenschutzerklärung zu

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.