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 2 3 [4] 5 6 7
Print
Author Topic: Loadup (formerly StartupManager) - A PureMVC AS3 Utility  (Read 72819 times)
jowie
Jr. Member
**
Posts: 19


View Profile Email
« Reply #45 on: April 18, 2008, 09:00:04 »

Hi Philip,

Apologies for the delay in replying- I never had a subscription email so I didn't realise anyone had replied!  :o

Let the animations proxy have a property that references a config object (approach 1) or maybe even references the config proxy directly (approach 2).  Let the music proxy have a similar property.
But I thought in PureMVC you were not allowed to communicate directly between proxies? Did you mean I should pass in the instance of the configProxy to both proxies when they are initialised? Is this allowed?

Thanks for your help!  :)
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #46 on: April 18, 2008, 09:36:44 »

There's no problem with a Proxy retrieving and interacting with another Proxy. The Proxies are able to encapsulate dependencies in the Domain Model this way.

So a Proxy could retrieve another Proxy, and set or get properties and call methods. What you don't want to do is have a Proxy retrieve a Mediator and interact with it in any way. That coupling is not good. The Model should have no knowledge of the View. This lets the same Model be reused in multiple applications with different Views and use cases.

By having the Model internally aware of different parts of itself, we're not encouraging a bad coupling. We might otherwise be tempted to push the Domain Logic that keeps the integrity of the Model into Commands, where Business Logic lives. If we try and reuse our Model and it requires a bunch of Commands to be present and registered then the Proxies are making a lot of assumptions about the application they're loaded into. Packaged separately, a Proxy could easily be allowed know the names of the other Proxies it collaborates with to maintain integrity in the Model.

-=Cliff>
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #47 on: April 18, 2008, 10:04:31 »

Philip,

Regarding your Retry Policy thinking above, it all sounds great. The parameters of the problem are pretty well thought out, and I'm sure the changes will be executed in the most usable way.

-=Cliff>
Logged
cmosretina
Newbie
*
Posts: 1


View Profile Email
« Reply #48 on: April 19, 2008, 07:32:16 »

Hi,

I just wanted to point out a tiny glitch I stumbled upon while going through the source code of the StartupManager utility...

At line 178 of the class StartupMonitorProxy.as, there's the following error-handling statement:

:
if ( proxy == null ) throw Error( proxy.getProxyName() + ISTARTUP_PROXY_MSG );

If ever executed, the preceding code would produce a TypeError: Error #1009, since proxy is not initialized.

The solution would be to replace proxy with r as in the following snippet:

:
if ( proxy == null ) throw Error( r.getProxyName() + ISTARTUP_PROXY_MSG );

This should work fine, as r refers to an instance of StartupResourceProxy that is most certainly instantiated.

Hope this helps.

And thanks for the great framework!
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #49 on: April 21, 2008, 03:13:48 »

Hi,

I just wanted to point out a tiny glitch I stumbled upon while going through the source code of the StartupManager utility...

Thanks for pointing this out.  It will be corrected at the next opportunity.  It may be that this error check is redundant, since the app resource proxy must have implemented IStartupProxy to even get accepted at instantiation of the StartupResourceProxy.  I know that this error check originated at a time when the utility was in development, pre-release, and the StartupResourceProxy did not exist in its current form.
----Philip
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #50 on: April 21, 2008, 07:13:10 »

I've made some progress with the dynamic asset loader sample - things correctly load when the called clip is present and correctly ioError when not present. My current problem boils down to the correct way to let the Startup Manager know that the process is complete.

Reviewing....I have concrete proxy called AssetManagerProxy that loads an xml list which declares what SWFs will be loaded. It's result handler triggers a command that dynamically instantiates an AssetProxy for each item on that list. If my AssetManagerProxy fires it's sendLoadedNotification at the point that it actually loads (as found in the StartupAsOrdered demo) none of the AssetProxies have yet been created and I end up with smCallOutOfSynchIgnored messages.

Deferring the sendLoadedNotification will eliminate the smCallOutOfSynchIgnored messages but cause other problems. Current code at juststeve.com/StartupAssets.zip

many thankx
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #51 on: April 22, 2008, 03:56:09 »

Steve, regarding your StartupAssets...
I have looked at your code, selectively.  This reply is with the hope of being helpful, but I acknowledge that I do not have practical experience with dynamic asset loading.  If I have misread your code or misunderstood the requirement, please forgive.

You depart quite a bit from the normal use of the startup manager, knowingly I'm sure, to try to achieve your goal, for example
  • AssetProxy invokes its own load(), and I suppose expects that the monitor will not
  • in AssetProxy, swf2Load is a String but is used also as type IStartupProxy.

In my opinion, the standard startup manager view of your requirement would be
  • use it once to do the first load via AssetManagerProxy, let that complete; I suppose you don't even need it for this single resource load
  • on completion of the first load, use it again, a new instance, to load the set of assets; these seem to be all known at that point; orchestrate it via the LoadAssetsCommand i.e. let it create the startup resources, set dependencies if any, and invoke loadResources(); let the utility invoke the load() operations in the normal way.

For the StartupManager to truly address dynamic loading, we would maybe need features like
  • tell it that resources will be added dynamically, so that it holds back on announcing completion
  • on dynamic addition of a resource, it re-invokes loadResources
  • tell it when all resources have been added.

----Philip
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #52 on: April 23, 2008, 07:19:05 »

Thx much for the review and comments. I'm going to have a look to to see if things work better if the AssetManagerProxy is just a plain old proxy instead of typing to a Startup manager - or otherwise establish the list of assets to import prior to invoking 'loadResources'.

Don't be too sure about my 'knowingly-ness'. I'm inclined to live with stupid code if they work or even seem to. I understand that attitude might disqualify me from communion with those of more pure motivations so I'm trying to upgrade my skills and raise my standards. ;)

So:
in AssetProxy, swf2Load is a String but is used also as type IStartupProxy.

falls into that category. Since I need swf2Load to be a string at one point and a of type IStartupProxy at another, what would be a more correct approach?

As to the bigger picture of accommodating dynamic assets, I think I'm fairly close to meeting my own short-term purposes so I probably won't be agitating for more attention to this issue unless/until someone else needs something along these lines.

That said...I still think management and monitoring (logging) of issues pertaining to application startup deserve more attention.

again...thankx for your time
--steve...
Logged
jowie
Jr. Member
**
Posts: 19


View Profile Email
« Reply #53 on: May 08, 2008, 10:10:30 »

There's no problem with a Proxy retrieving and interacting with another Proxy. The Proxies are able to encapsulate dependencies in the Domain Model this way.
That's good to know... Thanks Cliff! :)
Logged
chaocai
Newbie
*
Posts: 2


View Profile Email
« Reply #54 on: June 06, 2008, 05:40:12 »

Hi, I am pretty newbie, gotta a question...seems

LOAD_RESOURCES_REJECTED from pureMVC\Utility_AS3_StartupManager\trunk\bin\Utility_AS3_StartupManager_1_3.swc was missing?

I got Access of possibly undefined property LOAD_RESOURCES_REJECTED through a reference with static type Class. error, but was compiled and worked fine when I used Utility_AS3_StartupManager_1_2.swc
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #55 on: June 09, 2008, 03:03:52 »

Your problem has arisen because you have taken the startup manager swc from trunk/bin.  This is a new version of StartupManager.  It has not been tagged for official release yet.  See the version.txt file for the steps required to migrate from version 1.2 to this later version.

There is quite a bit of new functionality in this version. and though trying to keep migration steps to a minimum, nevertheless, for a better base going forward, some steps are required.  One step is: remove LOAD_RESOURCES_REJECTED from notification interests and handling.

There is a new release of the StartupAsOrdered demo, updated for this new StartupManager.
----Philip
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #56 on: June 10, 2008, 02:56:01 »

Cliff has "bagged and tagged" the new version (1.3) of StartupManager, so it is now officially available.  The objective has been to address some of the concerns and desires expressed here in the forum.

For convenience, here is the standard link to the utility
http://trac.puremvc.org/Utility_AS3_StartupManager

On that page, see the Release Notes link.

There is a reset feature, to facilitate reuse of StartupMonitorProxy. There is a facility for automatic retries.  Timeout is still there but has a different interpretation in the context of retries.  The idea of dynamic resources has been addressed as an open-ended resource list.

The StartupAsOrdered demo has been enhanced to illustrate use of some of these features - version 1.5 of the demo.
 
I hope this new functionality is of use to some of you.
----Philip

Logged
meekgeek
Full Member
***
Posts: 25


View Profile Email
« Reply #57 on: June 12, 2008, 10:48:38 »

 :)

Hey, it's been a long time since I've posted anything on this forum. I apologize if I'm just reiterating something that's already been said.

I just have a quick question..

Looking through this topic I've noticed some talk of asset managing. 
I love this manager.  It's great for setting up your backend, streaming, and xml connections at startup but if I want to load up another swf at runtime I feel that this manager shouldn't be in charge of it.  It's great right now!

I do however need a manager for loading one or multiple swfs.  I realize this tool is probably more geared toward a flash site where you don't need all the pages loaded at startup, just the ones the user wants to see.  It would be great if you could make a list of swfs then, have as3 use the URLStream class to just find the totalbytes of everything in your list(without loading), then begin loading with a proper progress event handler that gives you an accurate percentage of all the swf's, flv's, or images in the list.

I know justSteve has been working on something similar.  Should this constitute another utility?  Anybody else see a need for this?  Am I talking out of my butt?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #58 on: June 13, 2008, 07:00:18 »

Sounds like it could be another utility. But before muddying this thread with how it would work, perhaps a little elaboration on why you don't think startup manager is right for the job, and why it wouldn't be more appropriate to just extend it?

I'm ok with a new utility if folks think its warranted.

-=Cliff>
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #59 on: June 13, 2008, 08:13:19 »

I know justSteve has been working on something similar.

Funny...you misspelled 'mangling'. ;) ...actually, more like 'advocating for'  But make sure you are looking at the most recent version of StartupManager - the recent update references:

Added support for open-ended resource list.

Lately I've been grasping @ Pipes and am only just now getting enough time to take a look at it. Some time on it this weekend or bust. But speaking of pipes and 'other utilities' brings to mind the idea of a 'pipe aware' (or would that be multi-core aware) StartupManager to help with transModule management of Loading and starting up multi-core apps.

--steve...
Logged
Pages: 1 2 3 [4] 5 6 7
Print