# Dynamic Var names

**URL:** <https://forum.kirupa.com/t/dynamic-var-names/165403>\
**Category:** flash\
**Created:** [October 10, 2005, 9:46pm UTC](https://forum.kirupa.com/t/dynamic-var-names/165403 "2005-10-10T21:46:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![df0notfound](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@df0notfound](https://forum.kirupa.com/u/df0notfound)\
**Post date:** [October 10, 2005, 9:46pm UTC](https://forum.kirupa.com/t/dynamic-var-names/165403/1 "2005-10-10T21:46:50Z")

</div>

I’ve created a class which simulates an action for example a ball bouncing about a screen thus I’d create it like so:

```auto
var Ball1:ball = new ball(x,y);

```

How would I go about adding this to a loop, in a sense of every frame add another ball till you reach the maximum balls  
currently after looking in help, google and forums this is all I could find

```auto
var ["Ball"+currentball]:ball = new ball(x,y);

```

but this doesn’t seem to work and just causes

“ **Error** Scene=Scene 1, layer=balls, frame=1:Line 15: Identifier expected”
