Alex, I was using 3.2 - an oversight on my part - I upgraded to 3.3 and
it does seem to help but I'm also calling focusManager.deactivate() as
well. Since that, the combobox isn't an issue.
However there any number of different things I was doing that were
causing problems - like binding myModule.currentState to a model. One
of the challenges is injecting model data into the module that doesn't
create a refererence to the module anywhere. PopUpManager seems to be
problematic if the popup contains strong refereneces to the module or
its associated model.
I am making progress and what I'm hoping for in the end is a definitive
set of best practices concerning the use of modules. Hopefully some of
these issues might be made easier with somehting like
loader.unloadAndStop() but for modules.
Jeff
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Alex Harui
Sent: Friday, April 24, 2009 5:43 PM
To: [email protected]
Subject: RE: [flexcoders] Unloading Modules - Binding is the
Enemy?
Jeff, which version of Flex are you using? Can you make a test
case in two 20-line mxml files?
Alex Harui
Flex SDK Developer
Adobe Systems Inc. <http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui
<http://blogs.adobe.com/aharui>
From: [email protected]
[mailto:[email protected]] On Behalf Of Battershall, Jeff
Sent: Friday, April 24, 2009 11:57 AM
To: [email protected]
Subject: RE: [flexcoders] Unloading Modules - Binding is the
Enemy?
Gregor,
It does seem to be connected to the ComboBox issue - is this in
the Adobe BugBase? It doesn't turn up in my searches. I can get the
reference to release if I navigate to another module and then logout,
but if I change the selected index of the combo box to greater than -1
before that, it will not release no matter what I do.
This is a royal PITA because my instantiation code is based upon
a first time load of the module and if I cannot unload a module then my
method of injecting model objects into my module will have to be
re-done. If there's no workaround for this bug, then Modules are
effectively broken if something as commonplace as a combobox prevents an
unload.
Jeff
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Battershall, Jeff
Sent: Thursday, April 23, 2009 10:13 AM
To: [email protected]
Subject: RE: [flexcoders] Unloading Modules - Binding is the
Enemy?
Gregor,
Very interesting indeed. If I login, load the module,
interact with the combobox, logout, the instance remains in the
profiler. However if I do all that and THEN load another module and
logout, the number of instances of the first module goes to zero. These
modules are being loaded into a ViewStack, BTW.
Is this the FocusManager bug you described? Is there a
workaround?
I'd be thrilled to discover that Binding was not the
culprit here.
Jeff
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Gregor Kiddie
Sent: Thursday, April 23, 2009 9:40 AM
To: [email protected]
Subject: RE: [flexcoders] Unloading Modules -
Binding is the Enemy?
It does sound like you are describing the bug
where the focus manager holds onto the reference of the combo box and
stops the module unloading...
If you lose the combobox focus, does the module
unload?
Gk.
Gregor Kiddie
Senior Developer
INPS
Tel: 01382 564343
Registered address: The Bread Factory, 1a
Broughton Street, London SW8 3QJ
Registered Number: 1788577
Registered in the UK
Visit our Internet Web site at www.inps.co.uk
<blocked::http://www.inps.co.uk/>
The information in this internet email is
confidential and is intended solely for the addressee. Access, copying
or re-use of information in it by anyone else is not authorised. Any
views or opinions presented are solely those of the author and do not
necessarily represent those of INPS or any of its affiliates. If you are
not the intended recipient please contact [email protected]
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Battershall, Jeff
Sent: 23 April 2009 14:32
To: [email protected]
Subject: RE: [flexcoders] Unloading Modules -
Binding is the Enemy?
Thanks Pedro,
I've seen what your describing in the docs - I'm
looking at this via the profiler which is giving me feedback as to
number of live instances, etc.
Here's what I'm basing my statements on:.
1) I start up my app, which loads modules at
runtime based upon user choice from a menu.
2) Module exectues Cairngorm
Event/Command/Delegate to get array to populate a combo box. I'm passing
a reference to the module's model in my Cairngorm event and the model is
updated upon completion of the Command.
3) Combobox is bound (via MXML) to the model.
4) If I don't interact with the combobox, I can
then logout and unload the module successfully. The profiler tells me
there was previously 1 instance of the module and now there are zero
instances.
5) If I make the combobox active (by interacting
with it in any way), and then logout, the module remains in memory, with
the profiler reporting one instance instead of zero.
6) If I then login again, the Profiler reports 2
active instances of the module. Note that any model objects are
duplicated as well. For example, if my list of suppliers (used to
popuate my combobox) (a strongly typed AS class) was previously 64, the
profiler now reports there are 128 instances.
There's my behavior. When my UI object (in this
case ComboBox), becomes active, the binding becomes active and then the
module will not unload, even if I set the modules model to null before
attempting to unload. It would appear that I need to invalidate all
outstanding bindings to any data object before the module will fully
unload. This would seem to indicate that MXML binding (via curly
braces) isn't going to allow this.
Jeff