[ 
https://issues.apache.org/jira/browse/FLEX-34818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14493916#comment-14493916
 ] 

Mihai Chira commented on FLEX-34818:
------------------------------------

Thank you for posting the workaround, dimitri. I'm not an expert with FlexUnit, 
but if you supply a patch to add this information, I am happy to apply it to 
SequenceCaller. This way it will appear in the documentation once the next 
version of FlexUnit is released.

> FlexUnit SequenceCaller prevent function call on objet that delagate event 
> dispatching.
> ---------------------------------------------------------------------------------------
>
>                 Key: FLEX-34818
>                 URL: https://issues.apache.org/jira/browse/FLEX-34818
>             Project: Apache Flex
>          Issue Type: Improvement
>          Components: FlexUnit
>    Affects Versions: FlexUnit 4.2
>            Reporter: dimitri kara
>            Priority: Minor
>              Labels: flexunit, fluint
>             Fix For: FlexUnit 4.3
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> The Signature of SequenceCaller type the target of the call as 
> IEventDispatcher:
> SequenceCaller(target:IEventDispatcher, method:Function, args:Array = null, 
> argsFunction:Function = null)
> But the IEventDispatcher type on the parameter/field prevents us from using 
> the SequenceCaller on objects that *delegate the event dispatching*, and is a 
> real problem with Robotlegs-like architecture where Actors (models/services) 
> are not IEventDispatcher but use a common EventDispatcher object as an event 
> bus.
> The assumption was made that you would only use Sequence on IEventDispatcher 
> object, but you could listen on an EventDispatcher object while making call 
> on another object that with use the first one to dispatch events.
> Example of wanted behavior (with FileService not implementing 
> IEventDispatcher):
> [Test]
> public function TestFileService():void
> var service:IFileService=new FileService();
> var dispatcher:IEventDispatcher=new EventDispatcher;
> service.dispatcher=dispatcher;
>  var sequence:SequenceRunner = new SequenceRunner( this );
>   sequence.addStep(new  *SequenceCaller*( *service* , 
> lervice.loadDefaultFile));
>         sequence.addStep( new SequenceWaiter( *dispatcher* ,FileEvent.LOADED 
> , 100 ) );
> ...
> }
> [Update]
> I found a *workaround*. You can pass null as the target of the SequenceCaller 
> and it will be ok.
> So the correct code is:
> [Test]
> public function TestFileService():void
> var service:IFileService=new FileService();
> var dispatcher:IEventDispatcher=new EventDispatcher;
> service.dispatcher=dispatcher;
>  var sequence:SequenceRunner = new SequenceRunner( this );
>   sequence.addStep(new  SequenceCaller( *null* , lervice.loadDefaultFile));
>         sequence.addStep( new SequenceWaiter( dispatcher ,FileEvent.LOADED , 
> 100 ) );
> ...
> }
> It may help other people like me if this is added to the Docs.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to