Hi, thank you so much, I did something that I was trying for whole month :( ddd 
:) But now I have one more problem, this one is small :)

1) I make remote call to .NET to login user, everything is fine retrive data, 
check if user exists its ok, data from service are in proxy, this is my code 
for this:
[code]
public class LoginProxy extends Proxy implements IProxy
        {
                public static const NAME:String = "loginProxy";
                
                
                private var loginRemoteService:RemoteObject;
                
                public function LoginProxy()
                {
                        super(NAME, new User());
                        
                        loginRemoteService = new RemoteObject("fluorine");
                        loginRemoteService.source = "BL.Sample";
                        
loginRemoteService.LoginUserByEnteredData.addEventListener(ResultEvent.RESULT, 
onResult);
                        loginRemoteService.addEventListener(FaultEvent.FAULT, 
onFault);                 
                }
                
                private function onResult(evt:ResultEvent):void
                {
                        setData(evt.result);
                        sendNotification(ApplicationFacade.LOGIN_SUCCESFUL);
                }
                
                private function onFault(evt:FaultEvent):void
                {
                        sendNotification(ApplicationFacade.LOGIN_FAILED);
                }
                
                public function get loginUserData():User
                {
                        return data as User;
                }
                
                public function tryLogin(p1:String, p2:String):void
                {       
                        loginRemoteService.LoginUserByEnteredData(p1, p2);      
        
                }
        }
}
[/code]

Problem is in mediator, because I send successful notification from proxy to 
mediator, and I want to preview returned data ("Welcome: " + name + username + 
city ... etc.), but problem is because "loginUserData" is null. And in debug, 
data is full with data but they are private so can't use it, what I have done?


 
--- In flexcoders@yahoogroups.com, Simon Bailey <si...@...> wrote:
>
> > 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
> >
> >
> >
>


Reply via email to