September 17, 2005

Actionscript Date Extension Class

Over the past couple weekends, I've finally had the chance to finish up a class I started quite a while ago. I had made an extension to Flash's Date class but there were a ton of things that I wanted to change/add to the class when I had the chance.

I finally was able to get it to a nice stopping point and I felt it was a good time to set the code free into the real world. While this class isn't anything groundbreaking. It has a lot of really nice methods that will make date-based Flash applications a lot easier.

Here's a list of the methods in this class, I think the names are fairly self-explanatory.

  • getDayOfWeek
  • isSunday
  • isMonday
  • isTuesday
  • isWednesday
  • isThursday
  • isFriday
  • isSaturday
  • isWeekend
  • setDaysInMonth
  • get daysInMonth
  • getDaysLeftInMonth
  • get daysInYear
  • monthStartDate
  • monthEndDate
  • setWeeksInMonth
  • getWeeksInMonth
  • get daysInWeeks
  • get daysInWeek
  • getDay
  • getDayName
  • getMonthName

Download XDate Class

I know XDate is a slightly cheesy name but it actually has a fairly logical reason. It was based off the naming convention I came up with that all extention classes start with an 'X'. Please feel free to send me feedback.

Posted by PJ at September 17, 2005 02:04 AM | TrackBack
Comments

Was wondering if you could provide an example of how to use the getDaysInWeek or getDaysInWeeks operations.

I'm creating a date:
var year = 2005;
var month = 10;
var date = 15;
var xd = new XDate(year, month, date);
var dw = xd.getDaysInWeeks;

And dw is returning undefined. It appears that the days variable inside is also coming back as undefined.

And attempting to access the getDaysInWeek or getDaysinWeeks operation, and they are returning undefined. Is there something that needs to occur before calling

Posted by: Jeffery at October 19, 2005 03:29 PM