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

Pages: [1]
Print
Author Topic: Problem with proxy  (Read 7537 times)
rajah
Newbie
*
Posts: 3


View Profile Email
« on: March 29, 2010, 03:12:20 »

Greetings,

After developing with cairngorm for a long time i wanted to try out puremvc.
I understand most of the basics now but i'm having a problem with the proxy's.
When i register one, i can't check if i registered it.
:
if (!facade.hasProxy(getUserProxy.NAME))
{
trace(facade.hasProxy(getUserProxy.NAME));
facade.registerProxy( new getUserProxy());
}

If i run this code it keeps on saying it doesn't have the proxy yet and registers it again.
This way i can't get the data from my proxy.

But if i do the same with a mediator than this code works and i can retrieve the mediator.

Am i forgetting something special for a proxy?

Thanks in advance
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: March 29, 2010, 09:41:28 »

getUserProxy should be proper. You're referring to a class variable. The class (should be) GetUserProxy if get is intended to be part of the proxy name). Also, be sure NAME is static.

-=Cliff>
Logged
rajah
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: March 30, 2010, 02:14:56 »

Well thnx for the as3 lesson cliff ;)
But changing the class name will not help me solve my problem.

NAME could have been the problem so i changed it to GETUSER, but when i run the code:
:
if (!facade.hasProxy(GetUserProxy.GETUSER))
{
trace(facade.hasProxy(GetUserProxy.GETUSER));
facade.registerProxy( new GetUserProxy());
}
It still keeps returning me "false" every time i run this. I expect it to be false the first time offcourse, but after that i think i should be registerd? But it doesn't.
What am i missing?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: March 31, 2010, 09:48:49 »

Now you're using GETUSER?

Should be GetUserProxy.NAME, right? And GetUserProxy.NAME should be static, and your GetUserProxy constructor is passing NAME to super as the first argument? And is not overriding getProxyName?

In GetUserProxy, it should look like:
:
public static const NAME:String = "GetUserProxy";

public function GetUserProxy()
{
   super( NAME );
}

And your code that is attempting to register the proxy if it doesn't exist:

:
if (!facade.hasProxy(GetUserProxy.NAME))
{
trace(facade.hasProxy(GetUserProxy.NAME));
facade.registerProxy( new GetUserProxy());
}


-=Cliff>
« Last Edit: March 31, 2010, 09:50:21 by puremvc » Logged
rajah
Newbie
*
Posts: 3


View Profile Email
« Reply #4 on: April 02, 2010, 04:15:43 »

ai i forgot the super..  :-\

thnx  :) it's working now

Logged
Pages: [1]
Print