I was wondering if you were able to resolve this issue. I'm launching popups from within modules too, and am seeing the same behavior in 4.6.0. One popup will launch well, then another will launch incompletely; no title bar, border or close button, no arrangement really. Then I'll close and re-launch the app - only to have the SAME popup launch perfectly this time, and ANOTHER one (that was good last time) will go bad on me.
It's like whack a mole, but with popup bugs.
Here's the closest post I could find to describe the issue in general: http://gauravj.com/blog/2010/03/styles-and-popups-with-flex-4/
Unfortunately, the solution presented there (addition of "moduleFactory") does not seem to permanently fix the problem. That's right. I said "permanently" - for I'll think that cleaning, swaping themes, recompiling has fixed everything for the night's session - only to sit down the next morning to the same project - that presents the same random problems all over again.
I'm hoping that someone could identify the correct or incorrect combination of themes or components (halo vs spark, mx:TitleWindow, mx.managers.PopUpManager, etc ) to either avoid or use reliably.
Could any of these issues be related to the use of (Alex's) ModuleTitleWindow?
It's been a while since I found workarounds for this bug and I don't have the code at hand here, so I can only tell you what I did in general. The problem seems to have something to do with some styling objects being garbage-collected/unloaded before popup objects are instantiated. There are two possible workarounds.
(1) When loading your module, instantiate all the popup objects in that module by showing and immediately hiding them. Since popups have now been instantiated, it doesn't matter whether styling objects are garbage-collected/unloaded or not.
(2) Use ApplicationDomain.currentDomain as the first parameter of the load() function for loading modules. AFAIK, this prevents "things" from being unloaded. The code looks somewhat like below:
public var info:IModuleInfo;
info = ModuleManager.getModule(...);
I don't guarantee the correctness of this code, though, since it's been a while, and I am not coding Flex anymore (thanks God ). Good luck!
Thanks a ton for coming back to this thread, and even more for having a memory. I wish I had one of those.
It seems as though changing my own module loader lines
may have resolved the issue. Every one of the popups I tested after this change seemed to launch intact. Looks promising.
Forgive my cautionary wording, as my heart has been broken before (as I mention above). I'm going to shut down for the night and re-open and compile this project tomorrow - and repeatedly for a few more working days - and report back.
Using load(ApplicationDomain.currentDomain) might solve your problem, but then the modules will not unload.
What components you use is probably less important than the way you are determining the moduleFactory to pass in.
You can try using the –keep-all-type-selectors on the application and see if that makes a difference, but it will fatten the app by doing so.
And if you have a really small test case and a set of steps to reliably reproduce the problem, I will try to take a look.
Thanks for jumping in Alex,
I never saw any change when adding –keep-all-type-selectors - but I kept in in there anyway. I also set my library items to be compiled-in too - for the heck of it. Size does not matter so much. This is a corporate app that analysts will tend to fire up at shift start, and run all day.
This project was launched around version 3. It seems like the issue came with the shift to 4.5 or 4.6 - but I can't reliably confirm that. These are 2 fairly large modules that pop off a main panel, with a supply of popups each. Some are library objects (based on image which launch a popup when clicked, for example) and some are just TitleWindow components in src, the bug does not discriminate.
The modules are launched via a ModuleTitleWindow.as class gizmo - that I think you may have published a year or two back. Do I still need that in 4.6.0?
Anywhoo, I'll see how the project fares when I get back to it - within a day or two here; and see about condensing an example. I'm hoping that excercise will help me to isolate the problem or cause... which I'll bet is part of your secret little scheme - to help us to actually help ourselves...
I think it was 4.5 where we went to hierarchical StyleManagers which caused issues like you are seeing. I will be only mildly surprised if you find a bug in there. The order things get loaded might be making a difference.
I think if you want to popup a module’s main window you still have to resort to the trick from that blog article.
90% of the time, making you reduce a test case is a trick to get you to find the problem in your own code, but in this case, there’s a lot of tricky stuff going on and having the reduced test case just helps me figure out what went wrong faster. I’m 90% sure it will be a bug in Flex code or something we need to document better.