Frustrated at MVC and HTTPService!

Hi!

I’m trying to redesign a project I’ve been developing to fit a MVH architecture

I’m having trobule with the Model which consits of a class that contains a HTTPService object.

This is the MODEL:

package classes.model {
    import mx.rpc.events.ResultEvent;
    import mx.rpc.http.HTTPService;
    import XMLList;
    import mx.collections.XMLListCollection;
    import flash.system.Security;
   
    [Bindable]
    public class Stations {
        
        private var _httpService:HTTPService = new HTTPService();
        private var _xmlData:XMLList = new XMLList();
        private var _xmlDataColllection:XMLListCollection;

        public function Stations():void {
            getData();
        }
        
        public function getData():XMLListCollection {
            //This is needed for the Flash Player to grant access to load the PHP data
            Security.loadPolicyFile("http://localhost/crossdomain.xml");
            _httpService = new HTTPService();
            _httpService.url = "http://localhost/phpFile.php";
            _httpService.useProxy = false;
            _httpService.method = "POST";
            _httpService.resultFormat = "e4x";
            _httpService.addEventListener(ResultEvent.RESULT, onResult)
            _httpService.send();
            function onResult(event:ResultEvent):XMLListCollection {
               _xmlData = event.result.fields.field;
               _xmlDataColllection = new XMLListCollection(_xmlData);
               return _xmlDataColllection;
            }
            return _xmlDataColllection;
        }
    }
}

This is the VIEW:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init()"> 
    <mx:Script>
        <![CDATA[
            import classes.model.Stations;
            import mx.collections.XMLListCollection;
            
            [Bindable]
            private var stationData:Stations;
           
            private function init():void {
                trace (stationData.getData);
            }

        ]]>
    </mx:Script>
    <mx:VBox>
        <mx:DataGrid id="stationGrid" />
    </mx:VBox>
</mx:Panel>

When I run this, I get the following error:

Error #1009: Cannot access a property or method of a null object reference.

Please help me!