# setInterval with an array

**URL:** <https://forum.kirupa.com/t/setinterval-with-an-array/201587>\
**Category:** flash\
**Created:** [September 22, 2006, 6:48pm UTC](https://forum.kirupa.com/t/setinterval-with-an-array/201587 "2006-09-22T18:48:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Z11](https://avatars.discourse-cdn.com/v4/letter/z/97f17d/32.png) [@Z11](https://forum.kirupa.com/u/Z11)\
**Post date:** [September 22, 2006, 6:48pm UTC](https://forum.kirupa.com/t/setinterval-with-an-array/201587/1 "2006-09-22T18:48:47Z")

</div>

I would like to have a setInterval to be change able… for instance

somone clicked a button… i set an interval to do something along the lines of…

move the button over 1 px until it hits a specific area,

But I want to be able to use the same function… what I normally do for using variables with different names, is arrays… like

button[“picture\_1”]  
button[“picture\_2”]

… as far as I know THE only way to add variables into the NAMe of a variable, is to use arrays…

like…

button[“picture\_”+clicked]…

So I want to set an interval the same way…

myinterval[“anum\_”+numberhere] = setInterval…

however it ONLY seems to work without using arrays…

* * *

Either I need to know how to name variables based on other variables,

or how to get setInterval to be saved as an array, without speeding up each time it’s called…
