This content has been marked as final. Show 2 replies
I'm not sure how you're checking the time, but if you create a DATE object:
var now:Date = new Date(); This is actually a date and time object.
So, if you compare this date and Time object with a previous date and Time object using the Date method getTime() as follows
now.getTime() - previousDate.getTime() = the number of milliseconds that have passed between the "previousDate" and "now." If the difference is > 15*60*1000, 15 minutes have passed.
I did a hack job of a method that also works but yours is much more efficient.
Basically I compared getMonth, getHour, getDate, getMinute in a bunch of if statements and checked if it was same day and same hour. If it was check minutes and compare current minute with saved minute. If it was past 15 minutes then restart the count.
If it was different hour then reset the count
if it was different day reset the count
if it was different month reset the count
It worked exactly the same, the end result that is but your method is a lot more compact and saves about 40 or so lines of AS which is great.
Like i said mine is a large HACK that isn't too resource friendly but the swf isnt running constantly so isn't big deal really either way.
I learned a hell of a lot testing both ways and I like yours better even though both get the same results. Just, differently.. LOL