# Don't know how to loop

**URL:** <https://forum.kirupa.com/t/dont-know-how-to-loop/219133>\
**Category:** Uncategorized\
**Created:** [March 14, 2007, 5:05am UTC](https://forum.kirupa.com/t/dont-know-how-to-loop/219133 "2007-03-14T05:05:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lovejeet](https://avatars.discourse-cdn.com/v4/letter/l/977dab/32.png) [@lovejeet](https://forum.kirupa.com/u/lovejeet)\
**Post date:** [March 14, 2007, 5:05am UTC](https://forum.kirupa.com/t/dont-know-how-to-loop/219133/1 "2007-03-14T05:05:25Z")

</div>

hi all,  
wel i hv a problem looping a set of 6 images dat r being called frm a xml file.first set goes right but after d 5th one d counter shows 1 but displays 6th image on list.i need to loop d sequence.plz if anyone can guide me on dis…

wel here’s d as.

function init():Void {  
var imgNum:Number = iXML.firstChild.childNodes.length;  
total = imgNum;  
test=p;  
pos\_txt.text = "1 / "+total;  
var curPanel:Number = 0;  
p= 0;  
for (var i:Number = 0; i \< imgNum; i++) {  
var ob:Object = new Object();  
ob.id = i;  
ob.mc = tRef.panels\_mc.createEmptyMovieClip(“img”+ ob.id + “\_mc”, tRef.panels\_mc.getNextHighestDepth());  
ob.mc.\_x = (300 \* ob.id);  
ob.mc.loadMovie(iXML.firstChild.childNodes\*.attributes.src);  
test=“started”;

if(p==total-1)  
{

```
         removeAllChilds(tRef.panels_mc);
         //test=p;
         //p=0;
         init();
          tRef.panels_mc.createEmptyMovieClip("img"+ ob.id + "_mc", tRef.panels_mc.getNextHighestDepth());
          tRef.panels_mc.img.loadMovie(iXML.firstChild.childNodes[0].attributes.src);
         
         //tRef.panels_mc.easeTo("_x", tRef.panels_mc._x + 1200, 1.3);
         //loadxml();
         
      }

```

wel remmbr i am new to actionscript…:hugegrin:
