Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Issue communicating between a Fx Project and Fx Library Project w/o components  (Read 8593 times)
punchjunkie
Newbie
*
Posts: 9


View Profile Email
« on: May 01, 2008, 10:40:55 »

Hi Cliff,


This multiCore version of PureMVC is awesome. I've successfully created a Flex Library application with it's one facade and "LibraryApplication" class (instead of app.mxml) and everything works fine internally(notifications sent/received, etc).

Here is the problem I am facing; I have a reusable section for field validation in my Fx Library that makes use of a mediator, proxy and command. I can communicate to the validation logic from the parent application via a method call, but I can't find a way to communicate from the Fx Library Project back to the parent app.

I didn't want to use an interface because I want the library to be completely agnostic of any Flex application that would want to take advantage of it.

Is there some sort of communication "bridge" or "adapter" class that I can take advantage of to communicate between cores other than utilizing an interface?

Thanks!
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: May 03, 2008, 07:51:50 »

I've been working on a MultiCore app and finding the same problem, though for different reasons.

The approach I've taken is to let the module communicate with the parent app by sending events instead of making method calls. You can use a Mediator if you like to steward the module like any other view component.

-=Cliff>
Logged
punchjunkie
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: May 03, 2008, 07:12:54 »

I appreciate the response, know you are busy!


I'll go that route then; I also noticed the LocalConnection class for communicating between swf's. I am on mission to build some sort of traffic director between the cores in the long run, but in the short run, I appreciate your advice and I stick with that.

Look forward to anymore epiphany's that evolve from MultiCore library!

Thanks again!

-Tony
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: May 04, 2008, 12:23:59 »

LocalConnection isn't really a super answer either. It boils down to getting a handle to a connection to the swf you want to talk to by name (and you can get an error if another swf already has the connection). Connect gives it the method name to call and any parameters.

As with an interface, you're assuming knowledge about the other class, namely that it has a method name that takes the parameters you're giving it. That's the receiver-side implementation.

From the sender-side you could consider this equivalent to a PureMVC Notification. The sender isn't interested in the receiver implementation, it just sends a bundle of data along with a notification string (that'd be the method name for a LocalConnection.send()).

If it's going to be async anyway, I'd rather use Events in a Flex, Flash or AIR app.

If I simply cannot break up some function and must communicate syncrhonously, give the swf a collaborator with which it shares an Interface 'contract'.

Also, in the Modularity demo, you see these modules having a reference to a shell collaborator which they communicate with by contract. But Widgets could communicate with each other by contract as well. You still need some uber-structure into which they're loaded. But one widget might retrieve a reference to another either by sending an Event and having the Shell fetch and set the reference upon the first Widget, or by having a retrieveWidget method on the Shell that fetches and returns the reference immediately.

-=Cliff>
« Last Edit: May 04, 2008, 12:30:15 by puremvc » Logged
Pages: [1]
Print