易截截图软件、单文件、免安装、纯绿色、仅160KB

使用Fabrication+PureMVC开发multi modular Flex应用

PureMVC实现了简单的MVC框架,将应用分为model、view和control三部分。
好处很多了,降低了模块之间的耦合性、提高了程序的可维护性和可扩展性。
fabrication在PureMVC基础上做了扩展,简化了pureMVC的开发难度,下面简单介绍一下fabrication的开发过程。
首先,根据需要实现org.puremvc.as3.multicore.utilities.fabrication.components.FlexModule、FlexApplication、FlashApplication或者AirApplication。这就是View了。
在View中实现override public function getStartupCommand():Class 方法。返回初始化Command类,如下:
public class ConfigModuleStartupCommand extends SimpleFabricationCommand {

override public function execute(note:INotification):void {
registerProxy(new GetPropertyProxy());

registerCommand(ShellConstants.USERINFO_FIND, FindUserInfoCommand);

registerMediator(new ConfigModuleMediator(note.getBody() as ConfigModule));
}
}
在初始化类中,需要注册所需要的Proxy、Command和Mediator,Proxy主要用作和后台进行交互,查询和修改数据,这就是model了。
Command用作接收View中的事件,并做处理,一般情况下就是调用Proxy的方法。如下:
public class GetPropertyCommand extends SimpleFabricationCommand {

override public function execute(note:INotification):void {
var getPropertyProxy:GetPropertyProxy = retrieveProxy(GetPropertyProxy.NAME) as GetPropertyProxy;

getPropertyProxy.fetchProperty();
}
}
当Proxy方法得到后台反馈后,会出发成功或失败的事件。如下:
public class GetPropertyProxy extends FabricationProxy
{
static public const NAME:String = "GetPropertyProxy";

private var _remoteService:RemoteObject;

public function GetPropertyProxy(name:String = NAME, data:Object = null)
{
super(name, data);
setup();
}

private function setup():void{
_remoteService = new RemoteObject();
_remoteService.destination = "sysService";
_remoteService.showBusyCursor = true;
_remoteService.addEventListener(ResultEvent.RESULT, result);
_remoteService.addEventListener(FaultEvent.FAULT, failed);
}

p


相关文档:

Flex 标签和 AS 类

Flex最强大的特性之一就是它在标签和
ActionScript类之间创建了一个简单的映射。这是一个简单的概念,但是我多次发现不懂Flex的人对这点是如何工作的或者‘它为什么有用’理解
起来有困难。
对那些学习Flex的新手,这里有一些规则以及
一些简单的例子让你们以此开始学习这个特性。

例子 1 —— ......

Flex学习中

2010.2.21 初步印象
1. Flex工程的核心就是那个mxml文件,所有的代码或结构都是围绕它;
2. 与这个mxml文件同名的as文件,他们之间的关系有点像html与js的关系,而且还不用include;
3. 最终会生成一个与mxml文件同名的html文件,而flash文件会被嵌入进去的;
2010.2.22 与Sping,Hibernate集成
看了这篇文章:http://w ......

flex ModuleLoader ERROR记录

sdk3.2 下会有此问题.
项目中想用moduleLoader加载模块,达到模块化开发的目的.但是出现了共享变量的问题:
TypeError: Error #1034: 强制转换类型失败:无法将 Object@406e651 转换为 mx.messaging.messages.IMessage。
代码+上//   import mx.managers.PopUpManager;
//   private var popUpManage ......

flex分页

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="initApp()">
 <mx:Script>
  <![CDATA[
   public var pageRecordes:uint = 8;
   public var totalPages:ui ......

Flex List行背景色

 过去在对DataGrid设置行背景色时,感觉还是挺方便的,只要重写DataGrid的,如下
private var _rowColorFunction:Function;
public function set rowColorFunction(f:Function):void
{
this._rowColorFunction = f;
}
public function get rowColorFunction():Func ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号