Posted By

one984 on 05/06/10


Tagged

basic actionscript xml set up loading as3 URLLoader URLRequest


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

davidino1978
tspitzr


AS3 XML Setup


 / Published in: ActionScript 3
 

  1. var photoXML:XML = new XML();
  2. var xmlLoader:URLLoader = new URLLoader();
  3. xmlLoader.load(new URLRequest('xml/photos.xml'));
  4. xmlLoader.addEventListener(Event.COMPLETE, processXML);
  5.  
  6.  
  7. function processXML(e:Event):void
  8. {
  9. photoXML = new XML(e.target.data);
  10.  
  11. trace(photoXML.image)// trace all image nodes
  12. trace(photoXML.image.@width)// trace attribute of width
  13. }
  14. /*
  15. XML SHOULD LOOK LIKE THIS
  16.  
  17. <?xml version="1.0" encoding="utf-8"?>
  18. <gallery>
  19. <image width="500">http://1984interactive.com/photography/misc/IMG_0383.jpg</image>
  20. <image width="300">http://1984interactive.com/photography/misc/IMG_0383.jpg</image>
  21. <image width="100">http://1984interactive.com/photography/misc/IMG_0383.jpg</image>
  22. </gallery>
  23. */

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: emedesing on September 30, 2010

Si subieras todo el código incluyendo los import sería sumamente util :)

You need to login to post a comment.