I am having trouble accomplishing the following:
var some_xml:XML = new XML();
some_xml.onLoad = function(success) {
if (success) {
var rootNode:Object = some_xml.firstChild;
for (n = 0; n < rootNode.childNodes.length; n++) {
_root.createEmptyMovieClip("new_mc" + n, n);
_root["new_mc" + n]._y = n * 20;
_root["new_mc" + n].createTextField("text_txt", 10, 0, 0, 100, 15);
_root["menu_mc" + n].onPress = function() {
//this is what I can't to work.
loadMovie(rootNode.childNodes[n].attributes.loc, _root.empty_mc);
};
}
}
};
some_xml.load("some.xml");
This works fine if I use a number, but as soon as I try to use “n” within the function it throws an error. Would eval do this for me? I haven’t used eval before. Thanks.