WEB开发网
开发学院图形图像Flash Flex中PureMVC 学习小结 阅读

Flex中PureMVC 学习小结

 2009-03-18 12:00:20 来源:WEB开发网   
核心提示: 导入ApplicationFacade类. 声明一个函数为intApp()并在页面加载完成后执行:craationComplete = "intApp()";声明了一个变量facade,类型是ApplicationFacade,并执行start(),这样程序就启动了..

导入ApplicationFacade类. 声明一个函数为intApp()并在页面加载完成后执行:craationComplete = "intApp()";

声明了一个变量facade,类型是ApplicationFacade,并执行start(),这样程序就启动了..

第四步:

startCommand:

在ApplicationFacade中,我声明了AppConstance.START,这个通知与startCommand的映射,即,在程序开始执行时,就需要去执行startCommand

代码:

package myApp.Controller
{
    import myApp.AppConstance;
    import myApp.Model.userProxy;
    import myApp.View.chooseMediator;
    import myApp.View.loginMediator;
   
    import org.puremvc.as3.interfaces.ICommand;
    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.command.SimpleCommand;
   
    public class startCommand extends SimpleCommand implements ICommand
    {
        public function startCommand()
        {
            super();
        }
       
        override public function execute(notification:INotification):void
        {
            var body:Object = notification.getBody();
            var type:String = notification.getType();
            if(type == "myweb"){               
                this.facade.registerCommand(AppConstance.LOGIN,loginCommand);
                this.facade.registerMediator(new chooseMediator(body));
                this.facade.registerMediator(new loginMediator(body));
                this.facade.registerProxy(new userProxy());               
               
                this.sendNotification(AppConstance.TO_CHOOSE,body)
   
            }else{
                trace("不是本站");
            }
        }
       
    }
}

上一页  1 2 3 4 

Tags:Flex PureMVC 学习

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接