Flex - Parsley - Event Will Not Dispatch From Method in Result Handler -


i have command executes service call. in result handler, doing logic based off result data. if logic meets specific criteria, displaying confirmation popup. if user clicks continue button in confirmation popup, have method gets called, dispatches parsley event. parsley event not being caught. however, if dispatch parsley event inside result method, being caught. idea why event not being caught when dispatching outside result method?

for example...

[messagedispatcher] [bindable] public var dispatcher:function; 

i execute service call inside command:

public function execute(event:someevent):asynctoken { return service.callservice(event.type, false); } 

i have result handler this:

public function result(data:object):void { if (add logic here based off data) alerthelper.showcontinuequestion(onselection, "are sure want continue?"); } 

if user clicks continue button on confirmation popup, calls onselection method:

private function onselection():void { dispatcher(new someevent(someevent.upload)); } 

that parsley event, someevent, not being caught. however, if dispatch event after if statement, being caught , works fine. idea why not being caught when dispatched outside of result handler? tried in other commands too, , same thing.

found on spicefactory site, works designed. ended updating flag in model, versus dispatching event. have bindsetter listening changes flag in model. when flag set true, parsley event dispatched.

command object lifecycle

apart grouping executing method , result handlers dynamiccommand introduces special kind of lifecycle management command objects. creation of object not happen until matching message dispatched. becomes container managed object duration of command execution. it removed context after result or error handler have been invoked. during lifetime, managed object, can have dependencies injected, or take part in messaging during command execution. rather rare case, common usage scenario command object receiving dependencies needs execute command.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -