XML onLoad problem
i'm calling external xml file , loading flash.
i can pull varables out in onload function. here is.
var coursexml:xml = new xml();
coursexml.ignorewhite = true;
coursexml.load("presentslidesone.xml");
coursexml.onload = function(bsuccess:boolean):void {
if (bsuccess && this.status == 0) {
var xnroot:xmlnode = new xmlnode(3, this.firstchild);
var xnhelptext:xmlnode = new xmlnode(3,
this.firstchild.firstchild);
trace(xnhelptext.nodevalue);
}
else {
trace("document failed load or parse.");
}
};
//stop();
all these trace statements produce desired result.
however, can't data out , available globally. in other words, want same variable statements exist outside onload function call, can use data. know how this?
thanks,
i can pull varables out in onload function. here is.
var coursexml:xml = new xml();
coursexml.ignorewhite = true;
coursexml.load("presentslidesone.xml");
coursexml.onload = function(bsuccess:boolean):void {
if (bsuccess && this.status == 0) {
var xnroot:xmlnode = new xmlnode(3, this.firstchild);
var xnhelptext:xmlnode = new xmlnode(3,
this.firstchild.firstchild);
trace(xnhelptext.nodevalue);
}
else {
trace("document failed load or parse.");
}
};
//stop();
all these trace statements produce desired result.
however, can't data out , available globally. in other words, want same variable statements exist outside onload function call, can use data. know how this?
thanks,
that because telling flash do. variable declared "var" going local function created. choice drop var. of course if want global variable, declare _global variable!
ps: coursexml object own object , exists outside onload event handler function. once loaded stays there until remove it. data there freely available after loads.
ps: coursexml object own object , exists outside onload event handler function. once loaded stays there until remove it. data there freely available after loads.
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment