If statement & setInterval wont work?

hey out there,

i’ve a real simple battery level monitor that’s fictitiously sets a level indicator.

there’s a function that’s called using setInterval:


stop();
batLevelNo=100;
batLevel="(100%)";
function setBatLevel() {
	batLevelNo = batLevelNo-20;
	batLevel = "("+batLevelNo+"%)"
	bar._x = bar._x-5;
}
if (batLevelNo > 0){
	setInterval(setBatLevel, 500);
}

the thing is, i want to stop calling the function when the batLevelNo gets to 0 - but the:


if (batLevelNo > 0){
	setInterval(setBatLevel, 500);
}

doesn’t work, it just keeps going.

i have a feeling this is something obvious and i’m being a spoon, does anyone have any suggestions?!

many thanks,

jake