Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1087197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:54:28+00:00 2026-05-16T22:54:28+00:00

ExtendedDateChooser class is great solution for simple event calendar used in my flex project.

  • 0

ExtendedDateChooser class is great solution for simple event calendar used in my flex project. You can find it if google for “Adding-Calendar-Event-Entries-to-the-Flex-DateChooser-Component”
with a link of updated solution in comments of the post. I posted files below.

Problem in that calendar is text events are missing when month is changed.

Is there updateCompleted event in Actionscript just like in dateChooser flex component? Like in:

<mx:DateChooser id="dc" updateCompleted="goThroughDateChooserCalendarLayoutAndSetEventsInCalendarAgain()"</mx>

When scroll event is added, which is
available in Actionscript, it gets
dispatched but after
updateDisplayList() is fired, so
didn’t manage to answer, why are
calendar events erased?

Any suggestions, what to add in code, maybe override some function?

ExtendedDateChooserClass.mxml

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

   <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:mycomp="cyberslingers.controls.*" 
    layout="absolute"  
   creationComplete="init()">

   <mx:Script>


<![CDATA[
    import cyberslingers.controls.ExtendedDateChooser;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.controls.Alert;

public var mycal:ExtendedDateChooser = new ExtendedDateChooser();

    // collection to hold date, data and label
    [Bindable]
    public var dateCollection:XMLList = new XMLList();

    private function init():void
    {
        eventList.send();
    }

    private function readCollection(event:ResultEvent):void
    {
        dateCollection = event.result.calendarevent;

        //Position and size the calendar
        mycal.width = 400;
        mycal.height = 400;
        //Add the data from the XML file to the calendar
        mycal.dateCollection = dateCollection;
        //Add the calendar to the canvas
        this.addChild(mycal);
    }

    private function readFaultHandler(event:FaultEvent):void
    {
        Alert.show(event.fault.message, "Could not load data");
    }
]]>
</mx:Script>

<mx:HTTPService id="eventList"
      url="data.xml"
      resultFormat="e4x"
      result="readCollection(event);"
      fault="readFaultHandler(event);"/>

 </mx:Application>

ExtendedDateChooser.as

package cyberslingers.controls
{
import flash.events.Event;
import flash.events.TextEvent;

import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.CalendarLayout;
import mx.controls.DateChooser;
import mx.core.UITextField;
import mx.events.FlexEvent;



public class ExtendedDateChooser extends DateChooser
{
    public function ExtendedDateChooser()
    {
        super();
        this.addEventListener(TextEvent.LINK, linkHandler);
        this.addEventListener(FlexEvent.CREATION_COMPLETE, addEvents);
    }

    //datasource
    public var dateCollection:XMLList = new XMLList();

    //--------------------------------------
    //  Add events
    //--------------------------------------
    /**
     * Loop through calendar control and add event links
     * @param e
     */ 
    private function addEvents(e:Event):void
    {
        // loop through all the calendar children
        for(var i:uint = 0; i < this.numChildren; i++)
        {
            var calendarObj:Object = this.getChildAt(i);

            // find the CalendarLayout object
            if(calendarObj.hasOwnProperty("className"))
            {
                if(calendarObj.className == "CalendarLayout")
                {
                    var cal:CalendarLayout = CalendarLayout(calendarObj);

                    // loop through all the CalendarLayout children
                    for(var j:uint = 0; j < cal.numChildren; j++)
                    {
                        var dateLabel:Object = cal.getChildAt(j);

                        // find all UITextFields
                        if(dateLabel.hasOwnProperty("text"))
                        {
                            var day:UITextField = UITextField(dateLabel);

                            var dayHTML:String = day.text;
                            day.selectable = true;
                            day.wordWrap = true;
                            day.multiline = true;
                            day.styleName = "EventLabel";

                            //TODO: passing date as string is not ideal, tough to validate
                            //Make sure to add one to month since it is zero based
                            var eventArray:Array = dateHelper((this.displayedMonth+1) + "/" + dateLabel.text + "/" + this.displayedYear);
                            if(eventArray.length > 0)
                            {

                                for(var k:uint = 0; k < eventArray.length; k++)
                                {
                                    dayHTML += "<br><A HREF='event:" + eventArray[k].data + "' TARGET=''>" + eventArray[k].label + "</A>";
                                }
                                day.htmlText = dayHTML;
                            }
                        }
                    }
                }
            }
        }
    }

    //--------------------------------------
    //  Events
    //--------------------------------------
    /**
     * Handle clicking text link
     * @param e
     */ 
    private function linkHandler(event:TextEvent):void
    {
        // What do we want to do when user clicks an entry?
        Alert.show("selected: " + event.text);
    }

    //--------------------------------------
    //  Helpers
    //--------------------------------------
    /**
     * Build array of events for current date
     * @param string - current date
     * 
     */ 
    private function dateHelper(renderedDate:String):Array
    {
        var result:Array = new Array();
        for(var i:uint = 0; i < dateCollection.length(); i++)
        {
            if(dateCollection[i].date == renderedDate)
            {
                result.push(dateCollection[i]);
            }
        }
        return result;
    }

}
}

data.xml

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

<calendarevent>
<date>8/22/2009</date>
<data>This is  a test 1</data>
<label>Stephens Test 1</label>
</calendarevent>

<calendarevent>
<date>8/23/2009</date>
<data>This is  a test 2</data>
<label>Stephens Test 2</label>
</calendarevent>

</rss>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:54:28+00:00Added an answer on May 16, 2026 at 10:54 pm

    Just Change the FlexEvent.CREATION_COMPLETE in the ExtendedDateChooser.as to FlexEvent.UPDATE_COMPLETE

    That should do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.