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: Proxy to Proxy communication and SWFAddress  (Read 7564 times)
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile Email
« on: March 31, 2010, 02:23:35 »

Hi
In my current architecture I am using a proxy to handle all swfadddress requests.

It works fine except for browser url changes, which trigger  a SWFAddressEvent.CHANGE event, which in turn causes a notification to be sent.

Its a typical chicken & egg problem, the notification is sent BEFORE the view mediators have been registered.

If I kludge it by adding a half second delay it works.

What I'd like to do is instead start a polling emthod in the SWFAddress proxy, which checks/listens for all assets to be loaded BEFORE sending the notification.

What is the best way to handle proxy to proxy communication?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 01, 2010, 07:30:19 »

:
it works fine except for browser url changes, which trigger  a SWFAddressEvent.CHANGE event, which in turn causes a notification to be sent.

Its a typical chicken & egg problem, the notification is sent BEFORE the view mediators have been registered.

Then either:
A) Don't register the SWFAddressProxy until after the view has been prepared,
B) Use a Mediator instead of a Proxy to interface with SWFAddress

What is the best way to handle proxy to proxy communication?
Depending on your situation:
1) Proxy A retrieves Proxy B, invokes methods and sets properties on it. They are both registered during normal startup.
2) Proxy A creates Proxy B when needed, and maintains a reference to it so that it can invoke methods and set properties on it when needed.

Cheers,
-=Cliff>
Logged
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile Email
« Reply #2 on: April 01, 2010, 09:13:39 »

I think for my next project I will use a mediator.

I don't have time to refactor because of a deadline.

Option A wouldn't work for me because my load is broken down into 2 loads, and BOTH need notifications from swf Address immediately after the application inititializes, browser loads.

I've resorted to a polling method in my SWFAddress proxy, which checks for a 'loadCompleted' flag to be true. Only then does it send the notification.

This flag in the SWFAddress proxy is set via a command mapped to a LOADCOMPLETE notification sent from my main DataProxy, which handles all loading, parsing of data.




Logged
Pages: [1]
Print