ulfben

Sample Config XML load & parse

Apr 30th, 2013
11,244
0
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* SNIP */
  2. var configLoader:URLLoader = new URLLoader(new URLRequest("data/config.xml"));
  3. configLoader.addEventListener("complete", configLoaded, false, 0, true);
  4. /* SNIP */
  5.  
  6. private function configLoaded(e:Event):void {
  7.             var loader:URLLoader = e.target as URLLoader;
  8.             var configXML:XML;
  9.             try {
  10.                 configXML = new XML(loader.data);
  11.             }catch (e:TypeError) {
  12.                 trace("ERROR: could not parse the XML file.");
  13.                 return;
  14.             }
  15.             Conf._playerScale = configXML.playerScale.@value;
  16.             Conf._walkRate = configXML.walkRate.@value;
  17.             Conf._targetBuffer = configXML.targetBuffer.@value;
  18.             Conf._playerName = configXML.playerName.@value;        
  19.             Conf._musicURL = configXML.musicURL.@value;
  20.             Conf._endMusicURL = configXML.endMusicURL.@value;
  21.             Conf._mouseEdge = configXML.mouseEdge.@value;
  22.             Conf._scrollTime = configXML.scrollTime.@value;
  23.             Conf._captionsOn = configXML.captionsOn.@value as Boolean;         
  24.             Conf._scenePath = configXML.scenesPath.@value;
  25.             var firstLocation:String = configXML.firstScene.@value;        
  26.             createNewScene(firstLocation)
  27.             _currentScene.addEventListener(Event.COMPLETE, maybeStartGame, false, 0, true);
  28.         }
Advertisement
Comments
  • User was banned
  • Rteuixl
    217 days
    # text 0.21 KB | 0 0
    1. Best t33n active cpx link daily updates!
    2.  
    3. Copy and paste the link in a new browser tab and then hit enter!
    4.  
    5. https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
    6.  
    7. Remove the @
  • User was banned
  • Comment was deleted
Add Comment
Please, Sign In to add comment