AS for showing & hiding

Im a little stuck on a little thingy Im working on.

On my main scene are 20 objects visible.
I have a var thats named “totaal”.
When totaal is less than 2, then I want the objects 2 till 20,
instanceName1 _visible=false;
When totaal is less than 3, the objects 3 till 20 invisible, etc etc.

I can offcourse write a huge script with all simular lines, but maybe its possible to do this with an array or something.

Can anyone point me in the right direction ?
thx in advance