Hi there…
Okay …I just need help with this xml class code reading data from xml file…my problem is how to push the value in each array respectively…here’s the class file I’m using it…
import mx.events.EventDispatcher;
class GetData extends XML{
public var addEventListener:Function = null;
public var removeEventListener:Function = null;
private var blue:Array = [];
private var red:Array = [];
private var yellow:Array = [];
private var dispatchEvent:Function = null;
public function GetData(){
EventDispatcher.initialize( this );
ignoreWhite = true;
onLoad = onXMLLoaded;
}
public function load( file:String ):Void
{
super.load( file );
}
private function onXMLLoaded( loaded:Boolean ):Void
{
if( !loaded ){
onLoadError();
return;
}
var xmlNode:XMLNode = this.firstChild;
var n:Number = xmlNode.childNodes.length;
//trace(xmlNode.childNodes.length);
for(var i=0;i<n;i++){
trace(xmlNode.childNodes*.attributes.category);
///////////////////////////////
** this portion how to insert each category in each array respectively...**
//////////////////////////////
}
//dispatchEvent( { type: "onXMLComplete", target: this, b:blue, r:red, y:yellow } );
finalize();
}
private function onLoadError():Void {
throw new Error( "Error loading XML Doc" );
}
private function finalize():Void {
blue = null;
red = null;
yellow = null;
this = null;
}
}
//////////////////////////////////////////////////////////////////////////////////////////
and here are my xml file format
so i do manage tracing the attribute of category but how to put the value under each category respectively in each array…eg:
//category red
red.push([city,name,teamcode]);--> so the result will be 2 value will insert
//category blue
blue.push([city,name,teamcode]);--> so the result will be 4 value will insert
//category yellow
yellow.push([city,name,teamcode]);--> so the result will be 2 value will insert
SO any help are really appreciated…Thnaks in advanced…