# Help with mvc and xmllist - null values

**URL:** <https://forum.kirupa.com/t/help-with-mvc-and-xmllist-null-values/298874>\
**Category:** Uncategorized\
**Created:** [October 26, 2009, 5:02pm UTC](https://forum.kirupa.com/t/help-with-mvc-and-xmllist-null-values/298874 "2009-10-26T17:02:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mavwrx](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@mavwrx](https://forum.kirupa.com/u/mavwrx)\
**Post date:** [October 26, 2009, 5:02pm UTC](https://forum.kirupa.com/t/help-with-mvc-and-xmllist-null-values/298874/1 "2009-10-26T17:02:04Z")

</div>

I’m trying to load a xml file into my model class. I am loading it with a load class definied in the model.

I am calling the load class from the document class. If i then try to trace the object and the xml varibale I get a NULL value.

Any help would be great…

model

```auto

package  
{

    import flash.events.EventDispatcher;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    
    /**
     * ...
     * @author 
     */
    public class Photo extends EventDispatcher
    {
        
        private var xmlLoader:URLLoader; 
        private var totalImages:uint; 
        private var currentIndex:int = 0; 
        public var xml:XML;
        private var _file:String;
        public var xname:String;
        
        
        public function Photo() 
        {
            xmlLoader = new URLLoader(); 
            
        
        }
        
        public function load(url:URLRequest):void {
            xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); 
            xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, errorLoading); 
            xmlLoader.load(url); 
            
        }
        
        private function xmlLoaded(event:Event):void { // after the xml file is loaded, 
    
            xml = new XML(xmlLoader.data); 
            xname = "test";
    
        }
        
        private function errorLoading(error:IOErrorEvent) {
            trace("No/Wrong XML file specified"); 
        }
        
        public function get file():String {
             return "hi";
        }
        
            

    
        
    }
    
}

```

document

```auto

package  
{
    
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLRequest;
    
    /**
     * ...
     * @author 
     */
    public class Document extends Sprite
    {
        var photo:Photo;
        var view:View; 
        
        public function Document() 
        {
                photo = new Photo(); 
                photo.load(new URLRequest("images.xml"));
                
                
                trace(photo.xml);
                // view = new View(photo); 
                
                
        }
        
    
        
    }
    
}

```
