PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: jlahr on March 23, 2010, 07:16:02



Title: Which object implements IPipeAware?
Post by: jlahr on March 23, 2010, 07:16:02
I've seen it in the top-level Document class, the Facade and sometimes not at all.

Where's the best place to implement IPipeAware?

Thanks.


Title: Re: Which object implements IPipeAware?
Post by: jlahr on March 23, 2010, 07:25:41
I should mention that I'm working in a pure Flash/AS3.

I also see where it's common in Flex apps to create an IPipeAwareModule and extend that. Not sure if that's preferable to directly implementing IPipeAware or not. Thoughts?


Title: Re: Which object implements IPipeAware?
Post by: puremvc on March 23, 2010, 11:26:04
A Flex Module should implement IPipeAware. Or the loaded swf if you're using Flash so that would be the Document class. Not the Facade.

-=Cliff>


Title: Re: Which object implements IPipeAware?
Post by: jlahr on March 23, 2010, 05:49:41
Thanks, Cliff, this makes sense.

My only problem now is that I'm loading these SWF's in via a LoadSwfCommand in my Shell. This command generates a Loader based on url and then sends that off to the StageMediator with an ADD_TO_STAGE noftification.

What I'm having trouble doing is getting the StageMediator to cast the Loader as IPipeAware so that it can setup the pipes.

Is there a better way to do this?

I was thinking, based on a previous post, that maybe giving my SWF it's own SwfMediator which listens for ADDED_TO_STAGE and tries to case it to IPipeAware then, but I haven't seen anybody doing that in the examples so far.

Thanks again.


Title: Re: Which object implements IPipeAware?
Post by: puremvc on March 26, 2010, 01:49:51
The StageMediator probably shouldn't be the plumber here. I'd do that with a Command probably. The StageMediator wants to see this as a Sprite or something visual.

-=Cliff>


Title: Re: Which object implements IPipeAware?
Post by: Elephant on February 11, 2011, 10:37:49
Cliff,

Could you comment on why you find it preferable to implement IPipeAware in the Module class rather than in the Facade?


Title: Re: Which object implements IPipeAware?
Post by: puremvc on February 12, 2011, 10:59:13
Because you don't want to expose the Facade itself. That is internal to the core/module. You don't want to retrieve a facade from another core and take actions on it. By implementing an IPipeAware interface at the module level, are able to poke the pipes into it and send it messages without breaking the encapsulation of the module itself.

-=Cliff>