-=Deus=-
Joined: 27 Apr 2011 Posts: 7
|
Posted: Tue Apr 10, 2012 1:42 pm Post subject: Flex Mobile views and navigation |
|
|
Hello,
I'm currently developing mobile Flex application using Parsley framework and have some troubles with navigation between views.
Here is the short example.
1. My sample view is:
Code: |
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" ...>
<fx:Declarations>
<parsley:FastInject property="model" type="{AuthorizationPM}" />
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var model:AuthorizationPM;
]]>
</fx:Script>
<!-- Other components -->
<s:Button label="Enter" click="this.model.authenticate(usernameInput.text, passwordInput.text)" />
</s:View>
|
2. The corresponding presentation model (all configuration is defined in separate MXML config, so there are no Metadata tags):
Code: |
package presentation {
import domain.AuthenticationModel;
public class AuthorizationPM {
public var dispatcher:Function;
[Bindable]
public var isAuthenticating:Boolean;
[Bindable]
public var authenticationModel:AuthenticationModel;
public function authenticate(username:String, password:String):void {
this.dispatcher(new AuthenticateMessage(username, password));
}
public function authenticateComplete():void {
/* This code runs after authentication command has finished execution. At this moment I need to detect if the user was authenticated successfully and navigate to the next view. But the navigation logic is handled by the view itself and not by presentation model. */
}
}
}
|
So, my question is the following. Is there any best practice to notify the view about the completion of the authentication command, so I could push the next view to the view navigator?
Thanks in advance. |
|