Home  |  About  | Last |  Submit  |  Contact
AllQuests.com




Previous Question:  dynamic text help  Flash ActionScriptNext Question:  [ubuntu] Ubuntu 8.10 Alternate on FakeRAID  Installation Upgrades
Question expiration date ( Flash Kit Community Forums Flash ActionScript )
Updated: 2010-07-21 05:55:06 (2)
expiration date

Hi all,

I'm wating for a client to pay up and would like to get the money soon. They have told me the payment is in the mail but it's been over a week and I have not received anything. Anyway, I would like to set up a movie that will "expire" if the payment is not received by a certain date (considering he may lock me out of the site and I'll have no way of removing the files already uploaded). I've tried this piece of code, but it doesn't want to work:

expiryDATE = "2/8/2003";
myDate = new Date();
dateTODAY = (myDate.getMonth()+"/"+myDate.getDate()+"/"+myDate.getFullYear());
dateEXPIRE = "expiryDATE";
if (dateTODAY >= dateEXPIRE) {
gotoAndStop("Payment", 1);
} else {
gotoAndPlay("Scene 3", 1);
}

Any suggestion as to what I'm doing wrong? (I mean besides uploading the files before I was paid! It's a long story and they were an affiliate of my former employer.)

Thanks,

Liquid4012

Answers: expiration date ( Flash Kit Community Forums Flash ActionScript )
expiration date

You need to get rid of the "/"'s and treat the dates as numbers.

code:

// expiration date
expiration = "282004";
// new date object
todaysDate = new Date();
// day of month
currentDate = todaysDate.getDate();
// month of year (add 1 because this returns 0-11)
currentMonth = todaysDate.getMonth() + 1;
// year (4 digits)
currentYear = todaysDate.getFullYear();
// put them together
current = currentMonth add currentDate add currentYear;
// Compare dates
if (Number(current) >= Number(expiration)) {
// Request payment
}else{
// Work as normal
}



When you do this be sure to make your client aware of it, unless you don't want any future work from him.

electricbluemonkey

expiration date

You'll need to do something slightly different, actually. Writing Feb 8, 2004 as 282004 is not the best approach. In this format, January 1 of 2005 is "less than" the expiration date.

Either write the date as YYYYMMDD, always padding out to two-digit month and day, or use milliseconds since 1/1/1970, returned by Date.UTC().

The problem with your original code was that you were trying to compare two strings, not two numbers.

mkantor

Previous Question:  dynamic text help  Flash Kit Community Forums  Flash ActionScriptNext Question:  [ubuntu] Ubuntu 8.10 Alternate on FakeRAID  Ubuntu Forums  Installation Upgrades

- Source: expiration date Flash Kit Community Forums Flash ActionScript
- Previous Question: dynamic text help Flash Kit Community Forums Flash ActionScript
- Next Question: [ubuntu] Ubuntu 8.10 Alternate on FakeRAID Ubuntu Forums Installation Upgrades