1) What should I do/type to store data in proxy and in what var? Is
there any special var?
Typically the proxy is storing an Object with your data which could as
your quite rightly state, be a result from a service call of some
type. For example, an ArrayCollection containing all your user value
objects. The IProxy interface exposes a property named data which is
typed as an Object, this can be cast to data type you want and
instantiated in your Proxy class constructor, set through the data
reference and retrieved using a simple getter (see below):
public function UserProxy()
{
super( NAME, new ArrayCollection ); // second param is instantiating
the data Object casting as a new ArrayCollection
}
public function assignAllUsers( val:ArrayCollection ):void
{
data = val; // Assign the result from a service call to our data
array collection
}
public function get userArrayCollection():ArrayCollection
{
return data as ArrayCollection; // return the proxy data object as an
ArrayCollection
}
2) How to get specific data from proxy?
Using the public getter as shown above
3) What is the connection between commands and proxy
You can use a command to interact with the proxy e.g. pass login
information to the proxy which will send the data to a remote service
for verification.
4) If I have User Proxy with ability to log in user, log out user,
display user name, display user details... should I put all this in
one proxy or make separate:
loginProxy
getUserNameProxy
userDetailsProxy
etc.
Depends on what data, if we go by what you suggested i.e. username
password and general user details then I personally would have a
UserProxy which handles the user details as a whole.
HTH,
Simon
[ Blog ] nutrixinteractive.com/blog/
On 23 Jun 2009, at 11:34, vladakg85 wrote:
I try to learn this framework for a month, and I always stack
somewhere, and now I need help.
What I know: to make view, to make mediators, to make commands..
But, I don't understand proxy at all.
First what should be there. I think that this is the place where I
store service call methods and keep returned data from server so I
can use that data through every part of application (just to grab
them). Ok, maybe I am ok with this, but I don't know how to
implement this :(. 1) What should I do/type to store data in proxy
and in what var? Is there any special var?
2) How to get specific data from proxy?
3) What is the connection between commands and proxy
4) If I have User Proxy with ability to log in user, log out user,
display user name, display user details... should I put all this in
one proxy or make separate:
loginProxy
getUserNameProxy
userDetailsProxy
etc.
Please help me to understand this framework, I am crying :(`
Thanks, for any answer