TwelvestoneFlash

AS3 Building good Event communication


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
Storm
 
2010-03-09

WebServices class - Debugger MC + Class - Login MC + Class -LoginEvent Class

So, since the WebServices class has the elements to get the results of the login credentials from the server, my assumption is it should do the communication with the server and the parameters should bubble from the Login class?

The Debugger gets displayed with a key listener and it pops up the Login. The Login has the button that gets pressed and checks the text fields. Should it just communicate directly with the server or best to bubble up and have all communication through one class?

If Login should be independent, do I build my own WebServicesObject in that class too instead of passing it back?

mystic_juju
 
2010-03-13

Well, I wouldn't let the Login class deal directly with the server. That would give it a responsibility which doesn't belong to it. Your idea of letting it bubble makes more sense, though you probably want an even more robust architecture than what you are proposing. Ever think to use a framework (like PureMVC or RobotLegs?). If you used one of these, it makes the separation of responsibilities within your project much simpler. Mainly, I would suggest to enforce the MVC paradigm - ie., separate your model from your view completely and have the logic mediated either in your document class or a facade of sorts that holds references to both your view and your model. If you then let the login event bubble up to the document class, your mediator can relay the request to the model where it can be sent to the server. Once it comes back from there, you can once again relay that information from your model to your view, but this explanation is very simplified, and some thought would need to be put into how your whole system fits into place. If you have multiple things that need to know the login status of your application, you could also make use of a simple implementation of the observer pattern that would notify all observers of the current login status. Hope that helps, but if you post some code, I could make more concrete suggestions.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

AS3 Building good Event communication