You should use the 2.0.1 Modules feature for this, its pretty much
exactly what you want.
 
In any case, whenever you do make a reference to objects within
dynamically loaded code, you should design some interfaces for
communication so that you're not making hard type references to
implementation classes.  There are many design patterns that can provide
a useful scheme design base (the 2.0.1 Modules feature uses the
"factory" pattern to good effect here.)
 
-rg


________________________________

        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of jack_freud
        Sent: Monday, March 05, 2007 10:20 AM
        To: [email protected]
        Subject: [flexcoders] Flex embedding SWF file and using it like
a component
        
        

        I'm planning a rather large application that has several
sub-modules
        that I thought should be loaded individually as separate swf's
to
        decrease load time and memory requirements since the sub-modules
would
        never need to be loaded at the same time.
        
        I'm having trouble finding any articles on how to access the swf
from
        the swfloader once it's loaded.
        
        I found one blog from Peter Ent:
        
http://weblogs.macromedia.com/pent/archives/2004/12/accessing_swfs.cfm
<http://weblogs.macromedia.com/pent/archives/2004/12/accessing_swfs.cfm>

        
        but the sample files are not there any more, and it's from 2004
so I'm
        not sure if it would work with Flex 2 either...
        
        I'm trying to access the content of the loaded swf throught the
        swfloader's content property, but it's not finding the objects
within
        the swf because it hasn't been loaded yet, and so the outer mxml
will
        not compile without errors.
        
        Does anyone have any sample code that does this, or have a
suggestion
        as to whether this is a good design idea or not - I'm afraid of
        loading a Flex app with hundreds of screens and having it take
forever
        to load.
        
        Thanks!
        
        

         

Reply via email to