开发者

Adobe Flex Cairngorm - avoid singleton

Is there any way to avoid writing data to the singleton ModelLocator in Cairngorm?

In my current mxml files, I have something like

new LoginEvent(LoginEvent.GET_LOGIN_EVENT).dispatch();

And this fires off the event and command. In the command, we have something like开发者_开发百科:

public function result(data:Object):void
{       
  var returnedData:Array = data.result as Array
  model.login = returnedData;
}

Instead, I'd like to actually return the command result directly to the view. So, in the mxml file I have:

var loginResult:Array = new LoginEvent(LoginEvent.GET_LOGIN_EVENT).dispatch();

Which would necessiate the command changing to:

public function result(data:Object):array
{       
  var returnedData:Array = data.result as Array
  return returnedData;
}

Is this even possible?


You can use something like ViewNotifications. The idea is to add IResponders to events, so they can be used like callbacks to send data back to the view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜