# attachMovie(); fails ... when it shouldnt

**URL:** <https://forum.kirupa.com/t/attachmovie-fails-when-it-shouldnt/325067>\
**Category:** flash\
**Created:** [September 24, 2011, 9:06pm UTC](https://forum.kirupa.com/t/attachmovie-fails-when-it-shouldnt/325067 "2011-09-24T21:06:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claid](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Claid](https://forum.kirupa.com/u/Claid)\
**Post date:** [September 24, 2011, 9:06pm UTC](https://forum.kirupa.com/t/attachmovie-fails-when-it-shouldnt/325067/1 "2011-09-24T21:06:20Z")

</div>

// first the working function:

reps = function(){

b2nnereid\_kokku = 2 + 1  
iu=1  
while (iu \< b2nnereid\_kokku){  
var targetrida:String = “targetrida” + iu  
attachMovie(“rida”,targetrida,this.getNextHighestDepth())  
\_root[targetrida].\_y = (iu\*45)  
\_root[targetrida].\_x = 25  
\_root[targetrida].idrida = iu  
iu++  
}}

reps();

// ----so all seem cool i get all the mc-s to scene but if i load from external file and i kno  
// the stuff that gets loaded is ok and the same then - only the last mc is placed on the scene ☹  
// with correct parameters. But all the mcs created before that wont appare  
// problem code:violin:

repsnotok = function () {  
loadedinfo = new LoadVars();  
loadedinfo.load(“banners\_max.php”);

loadedinfo.onLoad = function( success ){  
if(success){

```
b2nnereid_kokku = int(loadedinfo.maxids)+1; 
iu=1
while (iu &lt; b2nnereid_kokku){
var targetrida:String = "targetrida" + iu
attachMovie("rida",targetrida,this.getNextHighestDepth())
_root[targetrida]._y = (iu*45)
_root[targetrida]._x = 25
_root[targetrida].idrida = iu
iu++
}

  } else {
     debugtextarea.text = "Error"
 } 

```

}  
}  
repsnotok();

//any ideas?
