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: A good way to load my PureMVC app into a shell swf?  (Read 11761 times)
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: March 08, 2010, 03:25:05 »

119kb seems reasonably small unless this is a mobile app, or one without much functionality.

IMHO, the hassle of breaking the thing half to trim that size down lies beyond the point of diminishing returns.

You can do it sure, but, I'm just sayin...
-=Cliff>
Logged
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« Reply #2 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.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: March 10, 2010, 11:21:39 »

If you're using Flex, you can always use a preloader. See http://darkstar.puremvc.org That's 440kb, but the preloader comes online as quickly as it would if moved it to a separate shell and loaded the rest of the app.

-=Cliff>
Logged
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« Reply #4 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.
Logged
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile Email
« Reply #5 on: March 13, 2010, 05:54:27 »

I can only share my preferences for loadup strategy.
One of the things that really irks me is long preload times for flash-flex sites...I don't care how interesting, life changing,  or potentially award winning the content, if I have to sit and wait for more than around 10-15 seconds....well..life is simply too short, you've lost me as a viewer!
Maybe I'm too impatient, but I think most casual surfers feel the same. It's also given flash (and especially Flex) a bad reputation as a seemless user experience. As a developer I also feel that part of my job is to 'educate' the client, letting them know that a long preload time (some clients expect this) isn't necessary.

So, having said that, I try and target the size of my 'main' swf to be no larger than 2-300K...and preferably under 200k! In an ideal world, IMHO there would be NO PRELOADERS! (and no 'skip intro' buttons;)

To load this I also use a 'shell' swf, but it is simply that, a shell, absolutely no logic other than to display a preload bar and load my Main swf. Lee brimelow outlines this simple scenario and gives reasons for this as a best practice over on gotoandlearn.
If I need to load further assets once Main is loaded using BulkLoader or some other utility, I do so, but usually in the background so it is transparent to the user. There should be at least some functionality in the site so the user doesn't feel like they need to wait to do something.

Structuring a load process properly takes more effort and time, which is probably why there are so many viewers staring at preloaders hoping their wait is worth it!
Just my 1.5 cents;)
« Last Edit: March 13, 2010, 06:12:39 by eco_bach » Logged
inchworm
Jr. Member
**
Posts: 13


View Profile Email
« Reply #6 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.
Logged
Pages: [1]
Print