# Counting to a certain year

**URL:** https://forum.kirupa.com/t/counting-to-a-certain-year/59510
**Category:** Uncategorized
**Created:** [August 1, 2004, 2:03pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510 "2004-08-01T14:03:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![HausMaus](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@HausMaus](https://forum.kirupa.com/u/HausMaus)
#### Post date: [August 1, 2004, 2:03pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/1 "2004-08-01T14:03:57Z")

</div>

Hi there

Can someone tell me how to create the smallest file possible, containing a movie in which it counts to a certain year?  
E.g. a movie where the numbers run for a while, stopping at the year 2001?  
I’ve tried several ways, but I’m sure there must be a more easy and more simple way using actionscript.  
Searching the forums didn’t help (but then again maybe I was using the worng keywords…). Thanks!

Paul

(thanks for the ‘Date Countdown Timer’-tutorial made by Senocular used as an example)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 2, 2004, 1:22am UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/2 "2004-08-02T01:22:20Z")

</div>

It’d be easier if you just used a dynamic text field instead of images; then all you would have to do is use actionscript to calculate a variable, have that variable be the year, and then have the dynamic text field display that variable.

I guess I’m not really clear what you want them to do … do you want them to keep going in sequence for awhile and then stop when they get to the right one or…?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 2, 2004, 11:01am UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/3 "2004-08-02T11:01:10Z")

</div>

> [@Goth Santa](#):
>
> I guess I’m not really clear what you want them to do … do you want them to keep going in sequence for awhile and then stop when they get to the right one or…?

Yep, that’s right. Just ‘rolling’ for a short while and then stop at the year 2001.

OK, using actionscript instead of pics is fine with me. But could you please tell me what are the right codes to be used then? (if it isn’t too much trouble, that is!) Thanks.

Paul

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 2, 2004, 11:25am UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/4 "2004-08-02T11:25:16Z")

</div>

> [@HausMaus](#):
>
> Yep, that’s right. Just ‘rolling’ for a short while and then stop at the year 2001.
> 
> OK, using actionscript instead of pics is fine with me. But could you please tell me what are the right codes to be used then? (if it isn’t too much trouble, that is!) Thanks.
> 
> Paul

Something like this?  
Set the date its counting down to in this line:

```auto
  
eventDate = new Date(thisYear, 7, 18, 18, 45);

```

Date = aug, since it starts with jan on 0.  
then the day = 18th, and the time = 18.45

You might need some changes, but that was what i had .

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 2, 2004, 5:09pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/5 "2004-08-02T17:09:14Z")

</div>

No, I’m sorry. It hasn’t got anything to do with actual counting up or counting down.  
It’s just a movie which stops counting at the **whole** year of 2001 (and no minutes, seconds etc.)…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 2, 2004, 5:13pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/6 "2004-08-02T17:13:19Z")

</div>

I’m not sure if you are wanting to start from the current year or something, but from what I figured you meant was just a variable that would subtract one every enterFrame, correct?

you could then just use

[AS]mc.onEnterFrame = function() {  
if(year\>2001) {  
year.text=year;  
}}[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 4, 2004, 5:37pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/7 "2004-08-04T17:37:06Z")

</div>

What I mean is something like this movie, only much more simple (=less kb!).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 4, 2004, 9:11pm UTC](https://forum.kirupa.com/t/counting-to-a-certain-year/59510/8 "2004-08-04T21:11:39Z")

</div>

ok heres a sucky way of doing it but hey…

```auto
function bump(){
	q++
	w++
	e++
	r++
	if(q>9){
		q=0
	}
	if(w>9){
		w=0
	}
	if(e>9){
		e=0
	}
	if(r>9){
		r=0
	}
	x++
	if(x==12){
		clearInterval(bumpV)
	}
}
if(initVar!=true){
	x=0
	q=0
	w=8
	e=8
	r=9
	initVar=true
	bumpV = setInterval(bump,75)
}

```

put that in the first frame of your timeline and ensure there are 4 dynamic text boxes with variable values “q”, “w”, “e”, “r” respectively (without the quotes) the

```auto
bumpV = setInterval(bump,75)

```

sets the interval that calls the function that rolls the numbers… change the integer at the end to spped up/slow down the rolling… and the

```auto
if(x==12){

```

determines when to stop the function… so just change this value to whatever you want if you want it to cycle more/less…

this will emulate what you had in your fla but using actionscript and text boxes rather than movie clips and images 😉

good luck mate

Prophet.
