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 / Architecture / Share Values in all Models? on: October 24, 2011, 09:22:13
I want to share a value (global) between all my Models. What is the most sound way to do this?

I can set these values when the application loads but where would the best place to put these values so that the Models would have access to them?

TIA,
Shinan
2  PureMVC Manifold / MultiCore Version / One faultEvent handler for all my Proxies on: July 21, 2010, 11:24:22
Hi,
I am using RemoteObjects in my proxies and I want to use the same FaultEvent handler for all my proxies. Part of the logic for the FaultEvent handler will be sending a notification to the application depending on what the fault is. My question is where should my faultHandler go? In a Mediator? a Command? or a standalone class? If standalone class, how do I call sendNotification from a standalone class?

Thanks In Advance
Shinan




3  PureMVC Manifold / Standard Version / Question about resetting an application built with PMVC on: October 24, 2008, 06:18:39
I have an application that uses deferred instantiation (mediators and proxies are only created when needed). When the user logs out, I would like a way to 'reset' the application into its initial state. Right now I am reloading the page that the application is loaded from but I am not sure what the PMVC approach might be.

Any help is appreciated. Thanks.
4  Announcements and General Discussion / Architecture / What is the purpose of the Observer? on: June 13, 2008, 08:19:34
Now that I am waist deep in my app I have a better understanding of PureMVC (mediators, proxies, notifications, etc...)

But where do observers fit into the big picture?

Anyone can provide insight?

TIA,
Shinan
5  Announcements and General Discussion / Getting Started / General Application Design Question on: June 03, 2008, 01:39:05
If I am logging in a user as loginVO. I will have many proxies and mediators (other than the loginProxy and loginMediator) that will need access to attributes of that user. What is the pureMVC way to store that user and retrieve it when needed?

TIA,
Shinan
6  Announcements and General Discussion / Getting Started / Question about startup on: June 02, 2008, 05:31:45
I'm not sure if I am thinking about this correctly or approaching it the correct way but here is what I am trying to accomplish:

I am using AMFPHP, Flex and puremvc of course

I am implementing user authentication and want to emulate user sessions in flex

When a user logs in to the Flex application I set a session var for the user in AMFPHP. Then if the user reloads the page with the flex application I want to detect that the user is already authenticated and instead of taking them to the loginView stack I want them to go directly to the applicationView stack.

I have logging in and out functional.

I also have a button on my loginView that triggers the loginMediator to checkSession. Upon success the view stack is changed to the application, upon failue the view stack is changed to the login. This button works.

I have a sendNotification in my StartupCommand. This is suppose to send a notification to the loginMediator to checkSession which handles sending the notification to update the viewstack. But this notification never is received and I have put everything to handle the notification in loginMediator.

How can I make sure that checkSession is automatically called right after the application loads?

Any help is appreciated. TIA,
Shinan
7  Announcements and General Discussion / Getting Started / Newbie Question about Proxys and User Authentication on: May 28, 2008, 11:50:33
I am finally starting to get my application off the ground. I am still trying to wrap my heard around all this since I am new to puremvc and flex.

I am authenticating a user using a remoteobject.

All that works, I am able to authenticate and change my viewstack if the authentication is successful.

On my view that is displayed after the user logs in I want to display a simple "Welcome, <username>"

How do I access my user object from an arbitrary view?

Here is my code for the loginProxy:
:
public class LoginProxy extends Proxy implements IProxy
{
public static const NAME:String = "LoginProxy";

private var loginService:RemoteObject;

public function LoginProxy( data:Object = null ){
super(NAME, data);

}

public function userLogin(username:String,password:String):void {
loginService = new RemoteObject();
loginService.source = "org.enohp.app.Userdao";
loginService.destination = "userService";
loginService.addEventListener( FaultEvent.FAULT, onFault );
loginService.getUserFromLogin.addEventListener( ResultEvent.RESULT, onResult );
loginService.getUserFromLogin.send(username,password);
}

private function onResult( event:ResultEvent ):void {
if (!event.result) {
Alert.show("You have entered an invalid username/password", "Login Error");
} else {
setData(event.result as User);
Alert.show("You have successfully logged in.", "Login Success");
sendNotification( ApplicationFacade.VIEW_FBAPP );
}
}

private function onFault(fault:FaultEvent):void {
Alert.show(fault.fault.faultString + "\n" + fault.fault.faultDetail, fault.fault.faultCode.toString());
}

public function get user():User
{
return data as User;
}
}

The loginProxy is called from a notification that is handled by my loginMediator:

:
private function onMouseClick(e:Event):void {
loginProxy.userLogin(theView.username.text,theView.password.text);
Alert.show(ObjectUtil.toString(loginProxy.getData()), "Login User from Login Mediator");
}

I thought  that my alert in the mediator should show the user that was authenticated but it returns null.

Any help is appreciated.

TIA,
Shinan
Pages: [1]