views:

387

answers:

1

The form is in a component lauched as a popUp, form data consists in:

login:String
password:String

I thought of a few different ways, but I don't like them..

  • in the popUp, send button triggers a function that gets the form values and stores them in an Object, then saves the Object in the model, then dispatches a CreateSessionEvent. The CreateSessionCommand execute method is called, and it send the HTTPService passing the object from the model. (but then what if the model somehow doesn't get update and I send the same request twice?)
  • I could try to get the form data from the command execute method itself.. how can I access them though, since it is a popUp (created with PopUpManager.createPopUp(this, LoginDialog),true))

I need some better Idea... I'd love to see an example flex+rail with restful xml application by the way, know of any?

+3  A: 

The best thing is to keep the credentials in the CreateSessionEvent class. You can then dispatch the event, the controller will pick it up and execute the corresponding command. In your command, you should invoke a business delegate that will make the httpservice call and respond back to the command. If you ever change the server communication to for instance Remoting, you can create another business delegate that knows how to handle remote object calls.

Christophe Herreman