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  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: November 16, 2009, 04:41:54
That would be my suggestion.

-=Cliff>

This may not be so easy as it looks like there is not a good way to get the current state out of the state machine. This is the general command I am attempting to use to attach to LoadupMonitorProxy.LOADING_COMPLETE notes that I want to be able to handler all use cases. Then in this command I can check my app state to know how to handle. Note that my CustomSimpleCommand grabs a ref to StateMachine from the facade. Is their a way to get the current state from state machine without having to track outside of state machine?

:
public class LoadingCompleteCommand extends CustomSimpleCommand
{
public override function execute(note:INotification):void
{
//if we are in the starting command we can move out of the state into the configuring commadn
if (this.stateMachine.currentState.name == StateNames.STARTING)
{
this.sendNotification(StateMachine.ACTION, null, StateNames.CONFIGURING_PRODUCT);
}
}
}
2  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: November 16, 2009, 01:56:55
I want to us the same LoadupMonitorProxy in different use cases but am having trouble identifying which use case was was being performed when the command attached to LoadupMonitorProxy.LOADING_COMPLETE fires. Maybe I need to track which state I am in with the state machine and check the state in my command and send the appropriate notification?
3  PureMVC Manifold / Demos and Utils / Re: Loadup - A PureMVC AS3 Utility on: November 16, 2009, 11:48:52
Let's assume that I have a ProductProxy that is responsible for retreiving products from the server. ProductProxy.data contains an object named ProductCatalog that stores all of the products that have been loaded onto the client. When my app starts I will call a method on the proxy named loadProductCatalog() which will get some basic info about each product. When a product is selected I will call another method on the proxy named loadProductDetails(prodId:int) that will be responsible for loading the details and merging them into the ProductCatalog(ProductProxy.data) structure.

I want to use the LoadUp utility in my system and am trying to figure out the best way to refactor this proxy to work with the Loadup.

First I believe I can simply rename loadProductCatalog() to load() and conceptially they will be the same thing. The  Product Proxy will be loading the products when load is called. So this naturally works. The point of confusion is how to handle other methods within my proxy. For the LoadProductDetails call, would I be best to to create a new proxy named ProdudDetailsProxy. This proxy would then contain only one method named load which would do the same thing as my old method named loadProductDetails. Then when this proxy loads the data, it would retreive the default instance of the ProductProxy and merge the just retreived ProductDetails into the ProductCatalog(ProductProxy.data) structure. So really my ProductDetails proxy would only be a short lived object since I only need it to load the data and merge it into my ProductProxy. Going with this pattern, it seems I would need a new proxy type for every load operation i plan to do on my model. I though it would be nice to keep load operations grouped within one proxy. For instance all operations related to a product would go inside a ProductProxy. What do you all think?

Thanks!!
Pages: [1]