Flex 4: Defining a XML data model in an Actionscript Class

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-06-02T16:22:48Z Indexed on 2010/06/02 16:23 UTC
Read the original article Hit count: 242

Filed under:
|
|

I'm really having a hard time accessing a data model I've defined in an Actionscript class in my Flex app. The following is my AS Class (Model.as):

package
{   
    import mx.rpc.http.HTTPService;

    public class Model
    {           
        private static var _instance:Model;

        public static function getInstance():Model
        {
            if (!_instance)
                _instance = new Model();    

            return _instance;
        }

        [Bindable] public var xml:mx.rpc.http.HTTPService = new mx.rpc.http.HTTPService();
        Model.getInstance().xml.url = "http://127.0.01/RAF/DATAPOINTS.xml";
        Model.getInstance().xml.resultFormat = "e4x";       

    }
}

I'm then trying to access this in my main application with the following code:

Model.getInstance().xml.send();
var sectorList:XMLList = Model.getInstance().xml.lastResult;

And it just keeps throwing errors. The errors are generic so I can't determine the source in debugging. Hope this is enough info...

© Stack Overflow or respective owner

Related posts about Xml

Related posts about flex