Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well asynchronous operations always have this affect on code bases, unfortunately there's not really a lot you can do. If your loading operations form some sort of 'Service' then it would be best to make a IService interface, along with the appropriate MVC Style architecture and use data tokens. Briefly:</p> <pre><code>//In your command or whatever var service:IService = model.getService(); var asyncToken:Token = service.someAsyncOperation(commandParams); //some messaging is used here, 'sendMessage' would be 'sendNotification' in PureMVC var autoCallBack:Function = function(event:TokenEvent):void { sendMessage(workOutMessageNameHere(commandParams), event.token.getResult()); //tidy up listeners and dispose token here } asyncToken.addEventListener(TokenEvent.RESULT, autoCallBack, false, 0, true); </code></pre> <p>Where I have written the words 'workOutMessageNameHere()' I assume is the part you want to automate, you could either have some sort of huge switch, or a map of commandParams (urls or whatever) to message names, either way best get this info from a model (in the same command):</p> <pre><code>private function workOutMessageNameHere(commandParams):String { var model:CallbackModel = frameworkMethodOfRetrivingModels(); return model.getMessageNameForAsyncCommand(commandParams); } </code></pre> <p>This should hopefully just leave you with calling the command 'callService' or however you are triggering it, you can configure the callbackMap / switch in code or possibly via parsed XML. Hope this gets you started, and as I've just realized, is relevant?</p> <p>EDIT: Hi, just had another read through of the problem you are trying to solve, and I think you are describing a series of finite states, i.e. a state machine. It seems as if roughly your sequences are FunctionState -> LoadingState -> ResultState. This might be a better general approach to managing loads of little async 'chains'.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload