Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Getting Started / Re: Using the same proxy to handle different responses. on: January 05, 2010, 02:11:17
Assigning a dynamic variable that's then used to branch later on felt hacky.
I wasn't sure I was using it the right way. I am accustomed to creating and managing  URLRequest Loader objects, not using HTTPService so the ASyncToken is new to me.
My insecurity was based on my lack of knowledge.

Thanks, Cliff.
2  Announcements and General Discussion / Getting Started / Re: Using the same proxy to handle different responses. on: January 05, 2010, 07:35:12
I understand that I have to wait for responses to come back in order to manipulate the response data. The Proxy implements IResponder and executes its result() function when the data gets loaded via a call to a delegate. The issue is that I only have one result function which handles one the return data. However, from the same Proxy, I make 2 calls ( loadNotes() and saveNote() ) that may return different data structures and I can't have multiple result() functions in my Proxy to handle differently structured response data.

As a temporary solution, I am assigning a dynamic variable to the async token before I send the request (as I'm using HTTPService to communicate). Then, when the result comes back I branch my logic based on that dynamic variable's value and send different notes accordingly. What I'm doing feels awfully hack-y though.
The good thing is that this proxy logic is insulated from the rest of the application due to the very nature of PureMVC.
3  Announcements and General Discussion / Getting Started / Using the same proxy to handle different responses. on: December 31, 2009, 07:28:36
I am using PureMVC for the first time in addition to Flex for the first time. I've already spent about a month with Flex and decided to use PureMVC as I wanted a more AS3 based solution.
I was able to reuse my past Flex work without much trouble but I'll definitely want to refactor later on.
Things are going well so far.

The only issue I have so far is regarding Proxies.
I'm a Flash AS3 website kinda guy... this application stuff is new to me.

I have two functions I want to call from NotesProxy.as
I call notesProxy.loadNotes() which gives me all the note data as a fat XML... great. I call it from a mediator now but I will put it into a Command later on. That's what commands are for ;)
I also want to call notesProxy.saveNote(DTO). makes sense, right... call "Notes" related functions from the NoteProxy.

The issue is that my result handler expects a fat XML but the response from my saveNote() call may only return the added note or a success="true" confirmation. It may not return the full xml structure that getNotes() uses
(I call 2 different Delegates, one for each of the functions, from one Proxy. The delegates just point to different http locations... I'll clean that up later);

Maybe the idea of a "Proxy" is eluding me.

I'd appreciate your help in pointing me in the right direction.

source at www.wasimsingh.com/pmvcapp/PMVCTest.zip

So far, I've enjoyed working with PureMVC and have already realised some of its benefits... and it's only been 2 days!
I'm learning quickly. Hopefully I'll be able to contribute to the project in some way.
Pages: [1]