# Dynamic Placement Of Images

**URL:** <https://forum.kirupa.com/t/dynamic-placement-of-images/210477>\
**Category:** flash\
**Created:** [December 19, 2006, 3:53am UTC](https://forum.kirupa.com/t/dynamic-placement-of-images/210477 "2006-12-19T03:53:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bairdb](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bairdb](https://forum.kirupa.com/u/bairdb)\
**Post date:** [December 19, 2006, 3:53am UTC](https://forum.kirupa.com/t/dynamic-placement-of-images/210477/1 "2006-12-19T03:53:55Z")

</div>

In the code below, I am loading in multiple images from based on an xml file. I am looking for a way to dynamically place the images depending on how many results are brought back. I have the starting points for the first image in each section in the code, I am trying to basically add about 40 pixels to those numbers for each image. Can anyone help me with this.

```auto

var xml = new XML();
xml.ignoreWhite = true;
Root = this
overText._visible = false;
xml.onLoad = function(success){
    if(success){
    NumOfCloth = this.firstChild.childNodes.length;
        
    for (i=0; i<NumOfCloth; i++) {
    Top = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
    Catagory = this.firstChild.childNodes*.childNodes[2].firstChild.nodeValue;    

if(Catagory == "Woolrich Upholstery Wool"){    
var clip = Root.attachMovie(Top+"Btn", Top, Root.getNextHighestDepth());
clip.ivar = Top;
clip._x = "104"
clip._y = "133"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut

}else if(Catagory == "Pre-Washed Denim"){    
var clip =Root.attachMovie(Top+"Btn", Top, Root.getNextHighestDepth());
clip.ivar = Top;
clip._x = "104"
clip._y = "217"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut

}else if(Catagory == "10 oz. Dry-Finish, Waxed-Cotton Canvas"){    
var clip =Root.attachMovie(Top+"Btn", Top, i);
clip.ivar = Top;
clip._x = "105"
clip._y = "299"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut

}else if(Catagory == "10 oz. Berber Fleece"){    
var clip =Root.attachMovie(Top+"Btn", Top, i);
clip.ivar = Top;
clip._x = "105"
clip._y = "384"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut
}else if(Catagory == "10 oz. Heavyweight Cotton Duck Canvas"){    
var clip =Root.attachMovie(Top+"Btn", Top, i);
clip.ivar = Top;
clip._x = "105"
clip._y = "468"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut
}else if(Catagory == "8 oz. Cotton Twill"){    
var clip =Root.attachMovie(Top+"Btn", Top, i);
clip.ivar = Top;
clip._x = "105"
clip._y = "552"
//clip.onRelease = detailed
//clip.onRollOver = quickOver
//clip.onRollOut = quickOut
}
}
    }else{
        trace("Error");
    }
};
xml.load(XML File);    

```
