MXML & SWC's are compiled into a final SWF.  Classes are compiled in the 
order in which they reference eachother.  They are immediately available to 
you when your Flex application starts.

Remote Shared Librarires (RSL's), allow multiple Flex applications (SWFs) to 
share the same components, both the internal Flex ones, and ones you make 
and plan to make available.  They are loaded in order, like the above with 
the addition of having to download the SWF they are in first; from then on, 
this SWF is cached in your browser cache.  You can treat them as normal 
components & classes that you can immediately access and call all methods 
on.

You have 2 options for lazy instantiation; one is to utilize gregarious 
amounts of queued or none creationPolicies for your containers, and the 
other is load in dynamically loaded SWF's.

While the former provides a lot more control over what is loaded, and when, 
as well as expediating the loading of your application, and improving start 
up time, eventually, in using all the app, all controls will eventually 
exist, just not be displayed.  For Flex 2 this isn't that huge of a deal, 
but for 1.5, even if a visual element isn't shown, it still is rendered, 
albeit slightly.  As such, things could slow down later on depending on what 
you are doing.

The other option is to build in sections and/or components in SWF's.  While 
this is the easiest way to load in multiple, unrelated sections with the 
ability to physically remove assets when you are done with them, thus 
clearing resources, this can become a management nightmare depending on how 
many SWF's you plan to use this way.  Additionally, although both SWF's can 
use the same RSL's, they cannot share resources, and classes loaded between 
them is too confusing to write briefly in this email.  Sometimes you have no 
choice to do this as it's the most efficient way, and utilizing interfaces, 
one can lessen the pain of having no compiler to help you connect things at 
runtime.  I personally recommend against this.

Hope that helps.

----- Original Message ----- 
From: "Courtney Couch" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Wednesday, November 09, 2005 12:35 AM
Subject: [flexcoders] Lazy loading components


I'm curious what others have found as a solution to this sort of situation I
find myself in.

I'm considering converting a rather large management console into Flex 2.0
(obviously not publicly available until the production release) and David
Mendels informed me that my particular concern might be able to be addressed
here.

The interface would be rather large and what I would really like to do is
compile discrete sections of the application using separate MXML files and
then have the compiled swc's or swf's lazy loaded when that part of the
application is accessed.

It looks as though RSL's still load all the libraries without any sense of
priority.  I would prefer that the libraries, swc's or whatever are only
loaded when specified either through a MXML tag (to allow the libraries to
be buffered and loaded before the user is expected to need it) or when
accessed.   The preferable method would obviously be to allow one to create
SWC's, reference them in the MX:Application tag, and then be able to do
something like <MX:loadLibrary library="someswcref" onLoad="someFunction()"
/>   and allow the object to be loaded with a callback once its loaded.
That would not only allow a developer to load objects when a user may
potentially want to use it, but it would allow for a callback so it could
potentially have a loading state end once the SWC is loaded.

I know a person could simply load the SWF using the load call but that seems
to put up walls of what parts can interact with other parts.  I'm not
entirely sure as to how the scope is affected with a load call, but I
suspect you don't have the access you would have in an application that's
directly loaded.  Having it built in to allow lazy loading would seem to
allow large applications.   There has to be something like this as anything
network wise needs to have methods to be concerned with network utilization.

-Courtney Couch
www.courtneycouch.com





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to