views:

170

answers:

2

I am writing a small flex application that will, eventually, call PHP services to perform its work. In the meantime, however, I would like to have it use local data in XML form to allow me to develop the Flex part independently of the data service.

What is the best way to do this?

I want to emulate a service like this:

public class Service {
    public function getIssues(project:String):ArrayCollection {}
    public function addIssue(issue:Issue):void {}
    // ...
}

Suppose I have the data stored in assets/:

assets/_project1_.data.xml
assets/_project2_.data.xml
assets/_project3_.data.xml

If I only ever needed to load one, I'd do the following:

<mx:HTTPService id="issueService" 
        url="assets/issues.xml" 
        fault="serviceFaultHandler(event)" 
        result="issueResultHandler(event)"/>

And invoke the service using issuerService.send(), populating my results as expected. How do I do this as though it were a RemoteObject instead, but keep my data local?

A: 

Easiest way would just be running a server locally.

CookieOfFortune
Sure, but I'm specifically trying to defer the work of writing the server; the object of my current exercise is to learn to write Flex apps, not to write PHP services.
Chris R
A: 

You might wrap the HTTP service in a PsuedoRemoteObject class that conforms to your service interface and returns the expected objects.

Joel Hooks
Does that object already exist, or must I create it? Also, that leaves me in charge of all of that event dispatch et al; there's got to be a better way, right?
Chris R