Flex中PureMVC 学习小结
2009-03-18 12:00:20 来源:WEB开发网这里我注册了所有的通知,从程序开始一直到欢迎界面.
第二步:
在PureMVC中Facade只有一个,而且永远不会被实例化,本程序中Facade命名为:ApplicationFacade.as
代码如下
package myApp
{
import org.puremvc.as3.interfaces.IFacade;
import org.puremvc.as3.patterns.facade.Facade;
import myApp.AppConstance;
import myApp.Controller.startCommand;
public class ApplicationFacade extends Facade implements IFacade
{
public function ApplicationFacade()
{
super();
}
public static function getInstance():ApplicationFacade{
if(instance == null){
instance = new ApplicationFacade();
}
return instance as ApplicationFacade;
}
override protected function initializeController():void{
super.initializeController();
registerCommand(AppConstance.START,startCommand);
}
public function start(app:myApp):void{
sendNotification(AppConstance.START,app,"myweb");
}
}
}
更多精彩
赞助商链接