# Concatting and variables

**URL:** https://forum.kirupa.com/t/concatting-and-variables/160955
**Category:** flash
**Created:** [August 30, 2005, 10:49pm UTC](https://forum.kirupa.com/t/concatting-and-variables/160955 "2005-08-30T22:49:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Histtin](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@Histtin](https://forum.kirupa.com/u/Histtin)
#### Post date: [August 30, 2005, 10:49pm UTC](https://forum.kirupa.com/t/concatting-and-variables/160955/1 "2005-08-30T22:49:43Z")

</div>

Hi, I’m trying to create function that stacks movie clips on top of each other, but I think I’m having some trouble with the syntax.

I have a movieclip in the library with a linkage name of “mcClip” (I know, it was a bad idea to use this name more than once).

This is on a frame on the stage:

/////Beginning of Actionscript/////

nTotalClips = 3 //depending on how many I want to stack  
newEvent();  
/////Function code//////  
function newEvent():Void {  
for(i = 0; i \< nTotalClips; i++){  
sDummy = [“mcDummy” + i]  
sClip = [“mcClip” + i]  
sLast = [“mcDummy” + (i - 1)][“mcClip” + (i - 1)]  
sCurrent = [“mcDummy” + i][“mcClip” + i]  
trace(sCurrent)  
this.createEmptyMovieClip(sDummy, this.getNextHighestDepth())  
if(i == 0){  
this.sDummy.createEmptyMovieClip(sClip, this.getNextHighestDepth())  
this.sCurrent.attachMovie(“mcClip”, sClip, this.getNextHighestDepth())  
} else {  
this.sDummy.createEmptyMovieClip(sClip, this.getNextHighestDepth())  
this.sCurrent.attachMovie(“mcClip”, sClip, this.getNextHighestDepth())  
this.sCurrent.\_y = sLast.\_y + sLast.\_height  
}  
}  
}

/////End of Actionscript/////

On the trace for sCurrent, the out returns “undefined” three times.

Thank you; I await your corrections/suggestions.
