Archive for November 15th, 2005

Update to Date Formatter

UPDATE: I guess I didn’t think this one through completely. If you are using a component such as the DateChooser component or other class that returns a Date Object, using the Date2 Class will be of no use. So using the DateFormatter static class makes far more sense. Thanks Darron for the heads up on this one.

The other day I updated Darron Schalls dateFormat.as into a static class. Not sure why I just didn’t extend the Date class.

Anyhow.. I’ve made the quick change. You can download the Date2 Class here along with a sample FLA [LINK]

Sample code:
[as]
import Date2;

var now:Date2 = new Date2();

trace(now.formatTo(“mm-dd-yyyy”));
trace(now.formatTo(“mmmm d, yyyy”));
trace(now.formatTo(“mm/dd/yyyy”));
trace(now.formatTo(“d-mmm-yyyy”));
trace(now.formatTo(“ddd, mmmm dd, yyyy”));
trace(now.formatTo(“short”));
trace(now.formatTo(“medium”));
trace(now.formatTo(“long”));
trace(now.formatTo(“full”));[/as]

Learn something new every day

That’s what I love about Flash and the Flash community. Not a day goes by that I don’t learn something new that somehow I missed.

I had a few minutes today and was just poking through George Medve’s TweenExtended Class [LINK] in SEPY and noticed “OnEnterFrameBeacon.init();”. Hmm.. I hadn’t seen that before.. So curious as I am, I researched it and came up with blog article written by Darron Schall back in Jan. 2004 [LINK]. Wow! How did I miss that? Or maybe I saw it and at the time didn’t have time to absorb it.

Anyhow.. the jist is that you can attach onEnterFrame’s to objects without having to hassle with creating your own movieclips and managing them. Pretty cool.

[as]
import mx.transitions.OnEnterFrameBeacon;

OnEnterFrameBeacon.init();

var myObject:Object = new Object();
myObject.onEnterFrame = function() {
trace(“nice!”);
}
MovieClip.addListener(myObject);[/as]

That’s the 2nd Kudo’s to Darron this week. DateFormatter Class

Return top