# Problem attaching clips to stage by xml

**URL:** <https://forum.kirupa.com/t/problem-attaching-clips-to-stage-by-xml/331148>\
**Category:** Uncategorized\
**Created:** [May 30, 2013, 7:39pm UTC](https://forum.kirupa.com/t/problem-attaching-clips-to-stage-by-xml/331148 "2013-05-30T19:39:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronmac](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@ronmac](https://forum.kirupa.com/u/ronmac)\
**Post date:** [May 30, 2013, 7:39pm UTC](https://forum.kirupa.com/t/problem-attaching-clips-to-stage-by-xml/331148/1 "2013-05-30T19:39:07Z")

</div>

I have a small problem attaching clips on the stage with xml. Here is the xml and the code (simplified versions)

\<xml\>  
\<dots\>  
\<item\>  
\<X\_positions\>  
\<Xpos\>100\</Xpos\>  
\<Xpos\>120\</Xpos\>  
\<Xpos\>130\</Xpos\>  
\</X\_positions\>

```
    &lt;y_positions&gt;
       &lt;ypos&gt;40&lt;/ypos&gt;
     &lt;ypos&gt;50&lt;/ypos&gt;
     &lt;ypos&gt;60&lt;/ypos&gt;
 &lt;/y_positions&gt;

```

\</item\>

\<item\>  
\<X\_positions\>  
\<Xpos\>200\</Xpos\>  
\<Xpos\>220\</Xpos\>  
\<Xpos\>230\</Xpos\>  
\</X\_positions\>

\<y\_positions\>  
\<ypos\>240\</ypos\>  
\<ypos\>250\</ypos\>  
\<ypos\>260\</ypos\>  
\</y\_positions\>  
\</item\>

\</dots\>  
\</xml\>

function xml\_loaded(e:Event):void {  
xmlData=new XML(e.target.data);  
var dotList:XMLList=xmlData.item;  
for each (var dot:XML in dotList) {  
for each (var X\_pos:XML in dots.X\_postions.X\_pos) {   
var g=dots.X\_postions.X\_pos .length();  
X\_poslist=new Array;  
X\_poslist.push(X\_pos)  
}  
for each (var Y\_pos:XML in dots.Y\_positions.Y\_pos) {  
Y\_poslist=new Array;  
Y\_poslist.push(Y\_pos)   
}  
for (var i=0; i\<g; i++) {   
dotclip\_mc=attach\_clip();  
}  
}  
}

function attach\_clip() {  
dot\_event=new dotclip\_mc  
dot\_event.x=(X\_poslist);  
dot\_event.y=(Y\_poslist);  
addChild(dot\_event);  
}

I have an array of xpositions and y-positions. I want to attach two lines of three dot clips each on the stage

Everything is working but I am just seeing two dot clips on the stage. It is just reading the last values in the array so I am guessing the three dots are in the same spot. How do I get it to read all three values of x and y positions?

Thanks in advance
