문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top