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

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Proxy / Delegate - Configuration and Setup on: April 23, 2009, 02:42:31
Hi,

I've used PureMVC for a couple of projects now and I'm very happy with it. In my current project I have quite a few RemoteServices to handle and to mix together.

I read through some posts and decided to lay out the different service calls into delegates as different DataProxies will need to make use of them and even I want to reuse those delegates in different applications.

My question is now about a best practice how to setup/configure the proxies with the delegates?

I like to handle object configuration and object dependency layout in constructors. So currently I would go with something like this:

:
public class ConfigureProxiesCommand extends SimpleCommand {

override public function execute(notification:INotification):void {

var configProxy:ConfigProxy = facade.retrieveProxy(ConfigProxy.NAME) as ConfigProxy;

var delegate:SomeDelegate = new SomeDelegate(configProxy.gatewayUrl);

facade.registerProxy(new RemoteProxyA(delegate));
facade.registerProxy(new RemoteProxyB(delegate));
}
}

Since the config data is retrieved ansync via XML, I now have to locations/commands for my modelsetup: ModelPrepCommand and ConfigureProxiesCommand as I can setup my delegates as soon as config data is available. What I'm not really happy with.

Also I've never seen any example where a delegate was instantiated in a command.

Any suggestions on a different/better approach on this?

thanks,
chris
2  Announcements and General Discussion / General Discussion / Re: getInstance() returning null on: March 26, 2009, 02:45:27
Hi,

I'm experiencing some similar error in my current project. It's pure AS3 using PureMVC Multicore and the Pipes Utility.

The strange thing is that the error occurs only after the 5th or 6th time I'm loading the module.

My constructor looks like this:

:
public class ApplicationFacade extends Facade {

public function ApplicationFacade(key:String){

super(key);
}

        /**
         * Singleton ApplicationFacade Factory Method
         */
        public static function getInstance(key:String):ApplicationFacade {
           
            if(instanceMap[key] == null ) {
           
            instanceMap[key]  = new ApplicationFacade(key);
            }
           
            return instanceMap[key] as ApplicationFacade;
        }
...
}

Suddenly the type of variable in the instanceMap is of type:

org.puremvc.as3.multicore.patterns.facade.Facade

the return value then of course is null.

Any suggestions?

thanks!
Pages: [1]