# Converting from AS 2.0 to AS 3.0

**URL:** <https://forum.kirupa.com/t/converting-from-as-2-0-to-as-3-0/328909>\
**Category:** flash\
**Created:** [July 1, 2012, 12:25pm UTC](https://forum.kirupa.com/t/converting-from-as-2-0-to-as-3-0/328909 "2012-07-01T12:25:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![YehiaFarag](https://avatars.discourse-cdn.com/v4/letter/y/ecb155/32.png) [@YehiaFarag](https://forum.kirupa.com/u/YehiaFarag)\
**Post date:** [July 1, 2012, 12:25pm UTC](https://forum.kirupa.com/t/converting-from-as-2-0-to-as-3-0/328909/1 "2012-07-01T12:25:31Z")

</div>

I am trying to position a MovieClip from XML file, in my project i’m using ActionScript 3.0 and i have got a code from the ActionScript 2.0 forum which is working perfectly fine, so i want to convert the below code to ActionScript 3.0

Can somebody help me in converting the below code from ActionScript 2.0 to ActionScript 3.0 ?

Thanks

Code:  
myXML = new XML();  
myXML.ignoreWhite = true;  
myXML.load(‘xml.xml’);

var map:Array = new Array();

myXML.onLoad = function() {  
aNode = this.firstChild.childNodes;  
len = aNode.length;  
for (var i=0; i\<len; i++) {  
obj = {}  
obj.xpos = aNode\*.attributes.xpos;  
obj.ypos = aNode\*.attributes.ypos;  
map.push(obj);   
dups(i);  
}  
};

function dups(i){  
duplicateMovieClip(\_root.button, “knop”+i, i+1000);  
ref = \_root[“knop”+i];  
ref.\_x = map\*.xpos;  
ref.\_y = map\*.ypos;  
trace(map\*.xpos);  
trace(map\*.xpos);  
};
