探讨Parsley框架下Controller更新View的方法
来源:互联网 发布:淘宝台服战网点 编辑:程序博客网 时间:2024/04/30 23:20
探讨Parsley框架下Controller更新View的方法,总结如下,摘录示例代码,备忘。
1. Message方法,不推荐
1.> controller中
[MessageDispatcher]
public var dispatcher:Function;
dispatcher(new LoginSuccessMessage());
2.> view中
[MessageHandler]
public function LoginSuccessHandle(LoginSuccessMessage):void {
}
2. ChangeWatcher方法,推荐
import mx.binding.utils.ChangeWatcher;
[Inject]
[Bindable]
public var model:LoginModel;
private function viewActiveHandler(event:ViewNavigatorEvent):void
{
ChangeWatcher.watch(model, "LoginStatus", function():void{
if(model.LoginStatus== "loginOK"){
}
else if(model.LoginStatus== "loginFail"){
}
});
}
3.1. 方法1
3.1.1 view中
import mx.binding.utils.BindingUtils;
[Inject]
[Bindable]
public var model:LoginModel;
private function viewActiveHandler(event:ViewNavigatorEvent):void
{
BindingUtils.bindProperty(this,"currentState",model,"LoginStatus");
}
private function LoginOKHandle():void{
// TODO Auto Generated method stub
}
private function LoginFailHandle():void
{
// TODO Auto Generated method stub
}
<s:states>
<s:State name="nologin" />
<s:State name="loginOK" enterState="LoginOKHandle()" />
<s:State name="loginFail" enterState="LoginFailHandle()" />
</s:states>
3.1.2 controller中
[Inject]
[Bindable]
public var model:LoginModel;
model.LoginStatus = "loginOK";
3.2. 方法2
3.2.1 view中
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:parsley="http://www.spicefactory.org/parsley"
currentState="{model.LoginStatus}"
>
[Inject]
[Bindable]
public var model:LoginModel;
{
// TODO Auto Generated method stub
}
private function LoginFailHandle():void
{
// TODO Auto Generated method stub
}
<s:states>
<s:State name="nologin" />
<s:State name="loginOK" enterState="LoginOKHandle()" />
<s:State name="loginFail" enterState="LoginFailHandle()" />
</s:states>
3.2.2 controller中
[Inject]
[Bindable]
public var model:LoginModel;
model.LoginStatus = "loginOK";
- 探讨Parsley框架下Controller更新View的方法
- angularjs框架下controller间的传值方法
- tp框架一个controller控制器对应一个view下的文件夹
- Parsley 框架简介
- view与其他controller和view之间的引用方法
- View Controller的生命周期
- View Controller 的生命周期
- 获取view的controller
- View Controller的生命周期
- 更轻量的View Controller
- View Controller 生命周期的各个方法的用法
- View Controller 生命周期的各个方法的用法
- View Controller 生命周期的各个方法的用法
- View Controller 生命周期的各个方法的用法
- View Controller 生命周期的各个方法的用法
- View Controller 生命周期的各个方法的用法
- View Controller生命周期的各个方法的调用
- View Controller 生命周期的各个方法的用法
- linux下使用yum安装gcc的几点心得
- amChart for Flex 破解
- java里的时间类
- JAVA 静态代码块和构造函数
- halcon摄像机标定
- 探讨Parsley框架下Controller更新View的方法
- Android---RadioButton(单选按钮)详解
- 关于redhat9.0与arm-linux-gcc 编译链版本问题
- 跟燕十八学习PHP-第十三天-常用数组函数讲解
- 圆角listview
- 新计划
- Windows PE研究
- C语言计算结构体长度
- java-使用import