Using a URLLoader to reference an external XML source file : URLLoader « Development « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Development » URLLoaderScreenshots 
Using a URLLoader to reference an external XML source file
         
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import flash.events.Event;
        import flash.net.URLLoader;
        import flash.net.URLRequest;

        public function loadXML():void {
            var xmlLoader:URLLoader = new URLLoader();
            xmlLoader.load(new URLRequest("users.xml"));
            xmlLoader.addEventListener(Event.COMPLETE,handleLoad);
        }

        public function handleLoad(event:Event):void{
            var usersXML:XML = new XML(event.target.data);
            myTextArea.text = usersXML.toXMLString();
        }
      
    </mx:Script>
    <mx:TextArea id="myTextArea" width="250" height="100" />
    <mx:Button click="loadXML()" label="Load in XML" />
</mx:Application>

   
    
    
    
    
    
    
    
    
  
Related examples in the same category
ww__w___.__j_a__v___a___2___s_.___c_om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.