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 / Re: Should loaded view components be strongly typed by their mediator? on: March 27, 2010, 11:37:29
Thanks for verifying my hunch guys.

Cliff — So it's ok for my view components to be document classes for flash files? I find this makes things very easy in many situations but I want to make sure the practice isn't frowned upon.

2  Announcements and General Discussion / Architecture / Re: Should loaded view components be strongly typed by their mediator? on: March 26, 2010, 12:32:15
Not really, no  ;D

In this scenario an interface seems like the right thing to do. However I would like to cast the net a bit further and ask if it's wise to be creating my view components this way? Would it be better to keep all flash files separate and build my components with them through composition? So instead of using the view component class as the document class for my fla i would just load the fla's swf and my view component class would create/store an instance of it. Seems like that would lead to extra work when handling events out of the swf as the component would need to listen for events and then relay them to the mediator.
3  Announcements and General Discussion / Architecture / Should loaded view components be strongly typed by their mediator? on: March 24, 2010, 10:58:02
I have a view Mediator named MyMediator. It has a view component of type MyComponent so its getter looks like this:

:
import com.myproject.view.components.MyComponent;

protected function get myComponent():MyComponent
{
return MyComponent(viewComponent);
}

I also have an external swf whose document class is set to MyComponent. When I load up all of my application swfs I pass that loaded component to MyMediator:

:
facade.registerMediator( new MyMediator( myLoadedComponentReference ));
This is typically how I setup my mediators/components. However I realize now that because MyMediator imports MyComponent that I am compiling the MyComponent class in two places ( in the main application which holds my puremvc mediator and in the MyComponent swf ). This all seems very wrong to me as I believe things should only be compiled in one location, otherwise it's just wasting memory and potentially dangerous.

Do you guys have some opinions on all of this? Should loaded classes only be referenced by interface?

- rob
4  Announcements and General Discussion / Architecture / Re: A good way to load my PureMVC app into a shell swf? on: March 13, 2010, 07:16:03
I agree with your sentiments on preloaders. I totally hate them and they always feel like this dumb obligatory animation task which tends to be pretty half baked by most of my designers.

Regarding your point about loading stuff in the background..I think that works in some scenarios but not all. Personally I don't like the idea because if something fails to load then the user is just going to be stuck without any kind of visual indication that something was supposed to happen. At least if they're seeing a progress indicator and it stops for whatever reason you can hopefully get community/QA feedback and determine the issue. When people just start saying things like 'the site freezes' or 'it's not doing anything' then that could mean any number of debugging issues.

Personally I like the idea of loading each module on demand and displaying a really simple preloader/spinner of some kind. Not unlike the hour glass or pinwheel on a Mac. But it really comes down to the specifics of the site and what kind of flow feels right.

Having said that the reason I would like a Shell, as I think I mentioned before, is really just as a safety net in case Main balloons for whatever reason and the project was due yesterday.
5  Announcements and General Discussion / Architecture / Re: Dynamic loading of components on: March 13, 2010, 06:54:32
hey eco,

I mentioned the idea in this thread: http://forums.puremvc.org/index.php?topic=1658.0 but I haven't tried it yet. Basically if you want to maintain strong typing I believe that you can make your components implement an interface and then just import that interface in your main.swf and type the loaded swf/component to that. I think things get tricky when dealing with events that your component might dispatch. Hopefully they're just in a separate class file which you can also import, otherwise you might want to check out this blog post about a hypothetical way to put events in interfaces. Though the summary of the article basically ends up by saying 'you can put events in interfaces, but it's probably better to just use AS3 Signals' http://www.davidarno.org/2010/02/24/actionscript-signals-events-and-interfaces/
6  PureMVC Manifold / Demos and Utils / Re: PureMVC Loadup Util giving fluctuating progress percentage on: March 11, 2010, 12:01:19
Thanks for the quick response :D I appreciate you taking the time to explain that to me.
7  Announcements and General Discussion / Architecture / Re: A good way to load my PureMVC app into a shell swf? on: March 10, 2010, 06:41:44
The project was actually a pure AS project just built using Flash Builder. I don't actually do Flex work at the moment.

I think I figured out a simple answer to my original issue and that's to use interfaces with my loaded custom classes. That way I'll still get code hinting in Flash Builder but I only have to import an interface and not an entire class which could potentially reference many other classes.

I'm still not entirely sure what to do about swc reliant scenarios like coding for Flash components using Flash Builder. Perhaps I could just use the swc library for code hinting and compilation errors but not actually merge the swc into my main project swf. I'll give that a shot.

Thanks for your patience Cliff. I think I'll stick with using a Main.swf and just be more vigilant.
8  PureMVC Manifold / Demos and Utils / PureMVC Loadup Util giving fluctuating progress percentage on: March 09, 2010, 08:30:17
I've been working with the Loadup for Assets demo and I'm getting some strange returns in my test project. Currently I'm loading an xml file, 2 jpegs and a swf. Loadup loads the xml file first and sets its progress percent at 25%. It then briefly ticks up to 26.32577979788008% before immediately dropping off to 9% and then counting back up to 100%. Below is the output from the console so you can see the notes that are being sent and the progress percentage. I thought that the util was supposed to count up to 100% for an entire group of assets. Am I missing something? (apologies for the long line lengths).

*Edit: I've noticed that it will also tick up to 100%, then down to around 75% to finish another asset and then tick back up to 100%*

——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: ApplicationNotifications.STARTUP
——————————————————————————————————————————————————————————————————————————————————
[object StartupCommand] running...
[object ApplicationMediator] created
[object ApplicationMediator] onRegister


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: LOAD_ASSET_GROUP
——————————————————————————————————————————————————————————————————————————————————


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=25


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luNewAssetAvailable
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
xml/site_data.xml


—————————————————��————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=25


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetLoaded
——————————————————————————————————————————————————————————————���———————————————————


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luLoadingProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Loading Progress: 25%


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
————————————————————���—————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=26.32577979788008


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=9.233931554644707


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
———————————————————————————————————���——————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=18.462746629577666


——————————————————————————————————————————————————————————————————————————————————
SEND NOTIFICATION: luAssetGroupLoadProgress
——————————————————————————————————————————————————————————————————————————————————
[object ApplicationMediator] :::::: handleNotification
Progress, %=43.12657278943433
9  Announcements and General Discussion / Architecture / Re: A good way to load my PureMVC app into a shell swf? on: March 08, 2010, 05:59:41
I agree however 119kb was not the original size, it was actually much closer to 300 or 400kb because I was using Away3D in some of my view components. I imported parts of away3D into the view component so I could make some 3d objects and listened for events from the view component in my mediator thereby importing the ViewComponent class into my Mediator. The whole thing ballooned the size of my Main.swf tremendously. My work around was to load my away3D objects as seperate swfs and to not use those static class vars for events, instead I just used strings. Maybe I'm just building my components incorrectly? However I also wanted to use Flash components (ComboBox, Checkbox, etc) which I did so as a swc merged into my code since pure AS projects can't do RSL. This too added to the size of Main.swf.  I could have also done the components as a swf but then I would have lost any intellisense in Flash Builder.

So basically I'm just concerned that I can't have a simple guaranteed 5kb Shell which allows me to do whatever I want in Main.
10  Announcements and General Discussion / Architecture / A good way to load my PureMVC app into a shell swf? on: March 07, 2010, 03:16:19
Going forward with all of my projects I would like to build a Shell.swf which loads Main.swf. Shell.swf would only hold a preloader and its purpose would simply be to keep my initial filesize down. Main.swf would create the PureMVC actors. I'm still learning how to keep my files tidy so they don't balloon but in my most recent project I used the LoadUp util with just a Main.swf and my entry point file ended up being 119kb after I connected all my proxies, commands and mediators.

What I'd really like to do is to keep using LoadUp but somehow tie it into the loading of the Main.swf by Shell.swf. Does this sound reasonable or do you guys have a better approach to this problem?

Thank you :D

- rob
11  Announcements and General Discussion / Architecture / Re: What is considered the best practice for adding viewComponents to the stage? on: February 01, 2010, 02:39:23
Is it ok to retrieve mediators in my commands? Or should i be going about that differently as well?
12  Announcements and General Discussion / Architecture / Re: What is considered the best practice for adding viewComponents to the stage? on: January 31, 2010, 01:21:43
thanks mariush!
13  Announcements and General Discussion / Architecture / What is considered the best practice for adding viewComponents to the stage? on: January 30, 2010, 12:10:50
First of all, thank you Cliff for all of your hard work on the framework and also your dedication to this forum. It's really great, as a self taught developer, to have places like this to go to which are active and responsive and help me along my way.

I have a rather simple application right now which displays a 3D timeline. The timeline has very little functionality and as such only needs one mediator. My current setup is an ApplicationMediator with a reference to the stage as its viewComponent, and a TimelineMediator with an instance of the 3D timeline as its viewComponent.

When I want to add the timeline to the stage/display list, I can think of two ways to do it. One way would be to send a notification with a reference to the timeline viewComponent as its body. Then the ApplicationMediator would handle that note and add it to stage. The other way is to have the ApplicatationMediator listen for a notification and then add the viewComponent through its mediator's reference in the facade.
:
addChild(facade.retrieveMediator(TimelineMediator.NAME).getViewComponent() as DisplayObject);
I've used both methods and they work well but I was wondering if there is an alternative best practice that maybe I don't know about? Is it ever wise to pass a stage reference to your Mediators and just forgo the ApplicationMediator/StageMediator all together?

Thanks!

- Rob
Pages: [1]