home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Diversos / painter_madness.swf / scripts / __Packages / CConfigLoader.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  767 b   |  32 lines

  1. class CConfigLoader
  2. {
  3.    var myXML;
  4.    var cbfunc;
  5.    function CConfigLoader(sConfigFile, cbFunc)
  6.    {
  7.       this.myXML = new CXML();
  8.       this.myXML.cbfunc = mx.utils.Delegate.create(this,this.onXMLLoad);
  9.       this.myXML.load(sConfigFile != undefined ? sConfigFile : "config.xml");
  10.       this.cbfunc = cbFunc;
  11.    }
  12.    function parse()
  13.    {
  14.       for(var i in this.myXML.oResult.config["static"])
  15.       {
  16.          for(var j in this.myXML.oResult.config["static"][i])
  17.          {
  18.             var parent = eval(i);
  19.             parent[j] = this.myXML.oResult.config["static"][i][j];
  20.          }
  21.       }
  22.    }
  23.    function onXMLLoad(bSuccess)
  24.    {
  25.       if(bSuccess)
  26.       {
  27.          this.parse();
  28.       }
  29.       this.cbfunc(bSuccess);
  30.    }
  31. }
  32.