Sunday, July 1, 2012

[Action Script] Converting from AS 2.0 to AS 3.0 July,2012

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[i].attributes.xpos;
obj.ypos = aNode[i].attributes.ypos;
map.push(obj);
dups(i);
}
};

function dups(i){
duplicateMovieClip(_root.button, "knop"+i, i+1000);
ref = _root["knop"+i];
ref._x = map[i].xpos;
ref._y = map[i].ypos;
trace(map[i].xpos);
trace(map[i].xpos);
};
Attached Files File Type: zip Flash-XML.zip (10.0 KB)
Converting from AS 2.0 to AS 3.0

Related Post



0 comments: