Flex 4: Defining a XML data model in an Actionscript Class
- by Steve
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...