# Flash Countdown

**URL:** <https://forum.kirupa.com/t/flash-countdown/250582>\
**Category:** Uncategorized\
**Created:** [January 30, 2008, 6:18pm UTC](https://forum.kirupa.com/t/flash-countdown/250582 "2008-01-30T18:18:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamerp](https://avatars.discourse-cdn.com/v4/letter/d/fbc32d/32.png) [@dreamerp](https://forum.kirupa.com/u/dreamerp)\
**Post date:** [January 30, 2008, 6:18pm UTC](https://forum.kirupa.com/t/flash-countdown/250582/1 "2008-01-30T18:18:33Z")

</div>

Hello,

I found a great flash countdown script through a tutorial, here is the action script-

this.onEnterFrame = function() {

```
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();

var targetDate:Date = new Date(currentYear,11,25);
var targetTime = targetDate.getTime();

var timeLeft = targetTime - currentTime;
var sec = Math.floor(timeLeft / 1000);
var min = Math.floor(sec / 60);
var hrs = Math.floor(min / 60);
var days = Math.floor(hrs / 24);
sec = string(sec % 60);    
if (sec.length &lt; 2){
    sec = "0" + sec;
}
min = string(min % 60);
if (min.length &lt; 2){
    min = "0" + min;
}
hrs = string(hrs % 24);
if (hrs.length &lt; 2){
    hrs = "0" + hrs;
}
days = string(days);

var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
time_txt.text = counter;

```

}

This works fine. However, I am attempting to change the targetDate by retrieving the last day of the month and counting down to that. Right now it counts to christmas. I know how to get the last day of the month through PHP, so I was thinking I could send the variables to the flash document and somehow replace 11,25 with $n (which is the month variable in my php) ,$lastday .

Here is the PHP

```php

$m = date('m');
$n = date('n');
$month = date('F');
$y = date('Y');
$find = mktime(0, 0, 0, $m, 0, $y);
$lastday = strftime("%d", $find);
print "&n=$n&lastday=$lastday";

```

I have tried loading the php file and then placing a variable in but I can’t figure it out and I am fairly new to actionscript.

Anything will help! Thanks
