AS3 Papervision 3D Debugging/Stats with PV3DDebug

I have been doing lots of Papervision 3D for a project recently and needed to debug some placement and camera issues.  I did a quick search and found PV3DDebug by Jason Bejot and it worked out great and is a pretty sweet utility I thought I would mention when you need to debug Papervision or even for inclusion as a debug console in all your papervision apps and games. It is a good base for your own consoles or debug panels. It is also a great tool to help out with focus and zoom issues and understanding with camera placement.

The code is really easy to drop in and you can get lots of info on the PV3D scenes and camera manipulation.

HOWTO: Using AS3 to Get Age from Birthday (Birthdate)

I had to implement a get age method for something we were working on. I was surprised to not find an AS3 version easily, so busted one out. I thought maybe this would be in as3corelib but nope. So posting this in case anyone else is looking for a get age script in AS3. It was quick so any improvements just post them. It will be added to my utilities classes on google code soon it is in quick form so you can jsut plop in an .fla or a class.

The pseudo code is the same for getting age in any language. Get current date, get birthdate to compare. Subtract the current years from the birthday years, then subtract one more year if the day or month is less than today’s day and month.

function calculateAge(birthdate:Date):Number {
var dtNow:Date = new Date();// gets current date
var currentMonth:Number = dtNow.getMonth();
var currentDay:Number = dtNow.getDay();
var currentYear:Number = dtNow.getFullYear();

var bdMonth:Number = birthdate.getMonth();
var bdDay:Number = birthdate.getDay();
var bdYear:Number = birthdate.getFullYear();

// get the difference in years
var years:Number = dtNow.getFullYear() – birthdate.getFullYear();
// subtract another year if we’re before the
// birth day in the current year
if (currentMonth < bdMonth || (currentMonth == bdMonth && currentDay < bdDay)) { years--; } return years; } function dateStringToObject(dateString):Date { var date_ar = dateString.split("/"); return new Date(date_ar[2],date_ar[0] - 1,date_ar[1]); } var dateNow:Date = new Date(); var checkDate:String = "11/25/1976"; var dateBirthday:Date = dateStringToObject(checkDate); trace("dateNow = "+dateNow); trace("dateBirthday = "+dateBirthday); trace("age = "+calculateAge(dateBirthday)); [/sourcecode]