Hello Roger, you told below that they only ever get loaded once. This
"loaded" mean loaded in memory or loaded by transferring over the wire?

I've made tests between Modules and SWFLoader, specifically about memory
consumption. In one of them, I called loadModule() and unloadModule()
several times (loading the same module, of course), and the memory only
increases! I think this is the expected (although not the willed) behavior
(as is in the SWFLoader) since Flash Player can't really kill (and free the
memory) a DisplayObject. It would be a hard work to remove all the
references of the loaded application's objects (without talking about the
Flex framework per se) to elect they to GC.

Thanks
Fabio Terracini


On 1/9/07, Roger Gonzalez <[EMAIL PROTECTED]> wrote:

 The main difference between modules and applications is that modules have
lower overhead, and they only ever get loaded once, no matter how many times
you load them.

If you're using the ModuleLoader API, keep in mind that you're losing
about half the functionality of the module system.  I will assume that you
are, because otherwise it would be obvious where to expose methods.  You
might want to play around with the lower level ModuleManager API just to get
a hang of what's going on - ModuleLoader is a pretty thin veneer over the
lower API.

Basically, what you want to do is to have your module implement an
interface, say IModuleWhatever.

Have your application implement another interface, say IShellWhatever.

Now, add an event handler in the shell application such that when the
module is loaded, you get called back.

The ModuleLoader's "child" property will be an instance of your module
class.  You can cast it to the interface inside the shell application, and
then do something like:

IModuleWhatever(moduleLoader.child).setupStuff(IShellWhatever(app))

-rg

 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Brian Holmes
*Sent:* Tuesday, January 09, 2007 8:05 AM
*To:* [email protected]
*Subject:* RE: [flexcoders] Re: Compiling modules

  Roger,
 Would it be possible to get an example of how a shell app could
communicate or pass data to a module and vice versa. I'm  having difficulty
understanding of how to expose methods on both sides that allow for
interoperability. What I'd like to do is to load  user data in the shell
application and then add modules at runtime as needed. If they require user
information then have them look to the shell for that information so it's
always in the same place.

And Also, I can't really see any real difference between a module and
another application except for it's extremely tedious to debug the
modules?!  Couldn't the module automatically look for a debug version of the
swf if the shell is a debug version?

Thanks,
Brian


 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Roger Gonzalez
*Sent:* Monday, January 08, 2007 2:35 PM
*To:* [email protected]
*Subject:* RE: [flexcoders] Re: Compiling modules

 I can't think of any reason why you would want to do this.

Modules are class factories, not instances.

You will create an instance of the class baked into the module, and then
the application can pass those parameters to the instance.

-rg

 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *John Kirby
*Sent:* Monday, January 08, 2007 12:32 PM
*To:* [email protected]
*Subject:* Re: [flexcoders] Re: Compiling modules

 Thanks for the examples.

Question... if you are passing parameters to a module I assume your url
syntax is the same as a SWFLoader (myswf.swf?foo=bar) ... but module has
no parameter property?  How do access passed parameters to a module?

phillips1021 said the following:

 See:

http://www.brucephillips.name/blog/index.cfm/2007/1/8/Example-Of-Using-Modules-In-Flex-201

for a simple example.


--
*Whether you think that you can, or that you can't, you are usually right.
*
 - Henry Ford

 ------------------------------
***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this
e-mail in error please notify the sender by return e-mail delete this e-mail
and refrain from any disclosure or action based on the information.
***

Reply via email to