# Using VARS with Switch/Case: Is this possible?

**URL:** <https://forum.kirupa.com/t/using-vars-with-switch-case-is-this-possible/311485>\
**Category:** flash\
**Created:** [July 8, 2010, 2:34am UTC](https://forum.kirupa.com/t/using-vars-with-switch-case-is-this-possible/311485 "2010-07-08T02:34:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![as3ohh](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@as3ohh](https://forum.kirupa.com/u/as3ohh)\
**Post date:** [July 8, 2010, 2:34am UTC](https://forum.kirupa.com/t/using-vars-with-switch-case-is-this-possible/311485/1 "2010-07-08T02:34:51Z")

</div>

I have an object that contains times to call a function. Would like to use Switch/Case to test against video stream time. Right now using a For loop every second to test against 50 times is causing super sluggishness. Hoping there is a better way that doesn’t require so much testing.

Sooo is it possible to use a Var as a Case testing numeral? Meaning…

> 

```
switch(nsTime)

```

{  
case 0 :  
break;  
case xmlData.slideTime1 :  
updateSlide(xmlData.slidePath1);  
break;  
case xmlData.slideTime2 :  
updateSlide(xmlData.slidePath2);  
break;  
// etc., etc.  
}
