Popa Mihai

PopaMihai.com – Flex, Flash, AIR and ActionScript articles and tutorials

Archive for the ‘URLLoader’ tag

Working with E4X – XML in Flex – Part 2 – Loading XML with URLLoader

leave a comment

Another way that you can use to load xml data in Flex is by using the URLLoader class.

To use the URLLoader class you must:

  • define a new URLLoader:
    var loader:URLLoader = new URLLoader();
  • add an event listener to the newly created URLLoader:
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
  • call the load method of the newly created URLLoader:
    loader.load(new URLRequest(url));
  • The load() method of the URLLoader class takes a URLRequest parameter.
    In this example I created a new URLRequest and in the URLRequest’s constructor I used the url parameter. instead of url I could used directly “xmlFile.xml” and I would have get the same result.

  • define the xmlLoaded function that will parse the loaded data

Read the rest of this entry »

Written by Popa Mihai

August 13th, 2009 at 12:37 pm

Posted in Flex

Tagged with , ,