all groups > flash actionscript > february 2007 >
You're in the

flash actionscript

group:

XML Loading Status



XML Loading Status mrSparkleS0ap
2/27/2007 8:24:09 PM
flash actionscript: I am trying to figure out the best way to Monitor the status of loading of an
ASP generated XML file.

I created a class that handles the loading of the XML but because it
continuously being updated I need to monitor its loading status.



import mx.utils.Delegate;
class WeatherStation {
// variables
public var $dataURL:String;

public var weather_xml:XML;
public var weatherInfo:WeatherInfo;
// constructor
public function WeatherStation(dURL:String, info:WeatherInfo) {
weatherInfo = info;
weather_xml = new XML();
$dataURL = dURL;
}
public function loadStation() {
weather_xml.ignoreWhite = true;
weather_xml.onLoad = Delegate.create(this, loadXML);
weather_xml.load($dataURL);
}
public function loadXML(success:Boolean):Void {
if (success) {
trace("-- LOADED XML -- ");
var RootNode:XMLNode = weather_xml.firstChild;
for (var x:Number = 0; x<RootNode.childNodes.length; x++) {
for (var y:Number = 0; y<RootNode.childNodes[x].childNodes.length; y++) {

weatherInfo[RootNode.childNodes[x].childNodes[y].nodeName] =
RootNode.childNodes[x].childNodes[y].childNodes[0].nodeValue;
}
}
} else {
//error msg.
trace("-- XML LOAD FAILED -- : " + success);
}
}

}
Re: XML Loading Status myIP
2/28/2007 1:19:17 AM
You mentioned that it is ?continuously being updated?. Is it being updated by
the ASP file therefore you need the latest version of this XML? If so you can
use the xml.getBytesLoaded () to see the progress. But if you need to stream
data into Flash, you may need to use something like Flash Remote or Media
Server. You may also be interested in the WebService class if you are setting
up a webservice.

Does this help? I am not sure what exactly you are asking.
Re: XML Loading Status mrSparkleS0ap
2/28/2007 8:59:36 PM
Thanks that helps a bit.

I'm building a flash App that is polling a ASP file. Unfortunately I have to
build the app on the existing ASP. The App runs in remote locations so I would
like to capture stats on time it takes to load as well as failures to load.
AddThis Social Bookmark Button