# AS3 help: Calling movieclips using variables

**URL:** <https://forum.kirupa.com/t/as3-help-calling-movieclips-using-variables/308205>\
**Category:** flash\
**Created:** [April 19, 2010, 3:31am UTC](https://forum.kirupa.com/t/as3-help-calling-movieclips-using-variables/308205 "2010-04-19T03:31:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SiegeFilms](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@SiegeFilms](https://forum.kirupa.com/u/SiegeFilms)\
**Post date:** [April 19, 2010, 3:31am UTC](https://forum.kirupa.com/t/as3-help-calling-movieclips-using-variables/308205/1 "2010-04-19T03:31:26Z")

</div>

Thanks in advance for anyone who can offer some insight into this matter.

I have a series of movieclips stored in the .fla library

Clip1 (class: clip1)  
Clip2 (class: clip2)  
Clip3 (class: clip3)  
Clip4 (class: clip4)  
Clip5 (class: clip5)

I want to be able to add each clip to the stage using a function where the number is a variable that can be added to the “Add movieclip” statement.

For example:

var x:Number = 1;

var “Clip” + x:“clip”+x = new “clip” + x();

so that the program inteprets the above as:

**var Clip1:clip1 = new clip1();**  
**addChild(Clip1);**

This was the only way I could think of adding a movieclip to a stage. I am open to any other option. I hope this was clear. I don’t have any code to post because I’m just trying to work through the logic of the program. Adding movieclips to the stage when the name of the movieclip has a variable in it, is the part I am stuck on. ☹

I hope this made sense.
