I am trying to call a functoin which will use the xml object to retrieve data and return the data to the function call. When I trace "test_var" inside the "book_xml.onLoad" functoin, it works. but I can pass the xml data out of the get_data function. Can anyone help???
********************
stop();
//define function
function get_data(id) {
book_xml = new XML();
book_xml.ignoreWhite = true;
book_xml.onLoad = function(sucess) {
test_var = book_xml.firstChild.childNodes[0].childNodes[0].firstChild;
};
book_xml.load("school_xml.asp?id=" + id);
return test_var;
}
//call function and retriev value
ret_var = get_data("105");
//trace value
trace(ret_var);
********************
********************
stop();
//define function
function get_data(id) {
book_xml = new XML();
book_xml.ignoreWhite = true;
book_xml.onLoad = function(sucess) {
test_var = book_xml.firstChild.childNodes[0].childNodes[0].firstChild;
};
book_xml.load("school_xml.asp?id=" + id);
return test_var;
}
//call function and retriev value
ret_var = get_data("105");
//trace value
trace(ret_var);
********************