# Bar Timer?

**URL:** <https://forum.kirupa.com/t/bar-timer/14745>\
**Category:** flash\
**Created:** [March 2, 2003, 6:22am UTC](https://forum.kirupa.com/t/bar-timer/14745 "2003-03-02T06:22:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cripple\_Guy](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@Cripple\_Guy](https://forum.kirupa.com/u/Cripple_Guy)\
**Post date:** [March 2, 2003, 6:22am UTC](https://forum.kirupa.com/t/bar-timer/14745/1 "2003-03-02T06:22:56Z")

</div>

Ok… I wanted to make a 10 second timer made out of bars. For example those preloaders that shows how much completed using a bar that goes to 100%. For the timer I wanted is it counts up to 10 then after that it stops for now. And plz tell me that how to restart the timer again. Thanx

---

<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:** [March 2, 2003, 7:12am UTC](https://forum.kirupa.com/t/bar-timer/14745/2 "2003-03-02T07:12:54Z")

</div>

Howdy…

This is the simplest way you can do the job with setInterval() function…

---

<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:** [March 2, 2003, 7:17am UTC](https://forum.kirupa.com/t/bar-timer/14745/3 "2003-03-02T07:17:14Z")

</div>

Aw man, you beat me to it Cyan :(…lol.

Good Job on that though 🙂

Start and stop and everything 😉

Well I had this so far…

```php
_root.createEmptyMovieClip("container", -1);
container._x = 100;
container._y = 200;
maxClips = 10;
i = 0;
function createClip() {
	if (i<maxClips) {
		with (_root.container.createEmptyMovieClip("bar"+i, i)) {
			moveTo(0, 0);
			lineStyle(1, 0x000000, 100);
			beginFill(0xE6E6E6, 100);
			lineTo(5, 0);
			lineTo(5, 10);
			lineTo(0, 10);
			lineTo(0, 0);
			_x = i*8;
			i++;
		}
	} else {
		for (j=0; j<maxClips; j++) {
			_root.container["bar"+j].removeMovieClip();
		}
		i = 0;
	}
}
createBar = setInterval(createClip, 1000);

```

If it means anything. Although Cyans method is pretty much better 😛

---

<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:** [March 2, 2003, 7:18am UTC](https://forum.kirupa.com/t/bar-timer/14745/4 "2003-03-02T07:18:02Z")

</div>

thats good… but i can u also tell me when its completes the bar gauge like say for example when i done loading it goes to frame 2 of the time line.

and… when its full, i want it stop, then when u press “one” button it will start all over. instead of reset/start

---

<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:** [March 2, 2003, 7:33am UTC](https://forum.kirupa.com/t/bar-timer/14745/5 "2003-03-02T07:33:58Z")

</div>

Sorry, lostinbeta… I wasn’t in front of computer today whole day, so I had to make it up fast… =) (Doesn’t this look like some sort of desease???)

\_root.createEmptyMovieClip(“container”, -1);

What is the advantage of using ‘-1’??? I saw some people doing it, but I don’t quite get that part…

Hey, Cripple Guy… I made that example for you to see what’s inside and learn how to do that by yourself… I cannot believe that you have learned all the material included in the file in 6 minutes… Open up the file and study how I have done it… I believe that what you are looking for will be solved automatically after you are done studying my file… (apply gotoAndStop() function later on)

Know what I mean??? :rambo:

---

<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:** [March 2, 2003, 7:36am UTC](https://forum.kirupa.com/t/bar-timer/14745/6 "2003-03-02T07:36:28Z")

</div>

Well the negative one is/was simple. I could put it back to 1, but originally I had it set up different where the clips were created on levels 1 and up, so I had to create the other clip on level -1 so it wasn’t overwritten.

Now it can be set to whatever, because I create the new clips inside of that clip now. I did that because it is easier to relocate the files x and y coords since all you have to do is move the container clip.

---

<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:** [March 2, 2003, 7:42am UTC](https://forum.kirupa.com/t/bar-timer/14745/7 "2003-03-02T07:42:48Z")

</div>

Oh… I think I get the point… Thanks… :beam:
