Have you tried a step-by-step debug with variable tracing? You will discover which one is null. Then report back here.
Anyway I hope that the TitleWindow class is defined in the subApp project and not in mainApp project. But I don't know anything about your class map so I can't say anything right now. Try the step debug and see what comes from it.
Should be in the release notes that you have to force link PopUpManager into
the main app in 4.x
Thanx for replying!
Yeah, i know about the managers inclusion stuff, but this is not the solution (well at least not for me). Doing 5 years of flex development
now and that is a trap that i wont step into no more :-)
I created a proof of concept which you can try.
- download and extract
- open FlashBuilder4
- swich workspace to popup_swfloader_problem_workspace
- import existing projects into workspace, select the popup_swfloader_problem_workspace and all 4 projects inside
- look at the main app source: it force includes popup manager, also the alerts are working so this force include seems redundant anyway
- run the main app and get a run time error only for the flex 3.5 alert, the others are working just fine
Note that the flex 3.5 runs in a sandbox so it shouldn't even use the popupmanager from main...
Note 2 this is an air application but i tested it with pure flex too. Loading the subapp in a sandbox or in the same securitydomain as the main app makes no difference. Gives exacly the same error:
Main Thread (Suspended: TypeError: Error #1009: Cannot access a property or method of a null object reference.)
and code where i get a null pointer:
if (window is IUIComponent)
IUIComponent(window).isPopUp = true;
which is inside PopupManagerImpl (of flex 4.1 ??? The sandboxed should use it's own 3.5 impl right?)
public function createPopUp(parent:DisplayObject,
modal:Boolean = false,
childList:String = null,
moduleFactory:IFlexModuleFactory = null):IFlexDisplayObject
This thing is really puzzling me! I really hope you can take 5 minutes to do the steps above and share your findings.
- download and extract
I don't have time to set it up right now. Maybe you didn't add
-includes=mx.managers.systemClasses.MarshallingSupport to the main app? 3.5
has marshallingsupport built in, so it will try to leverage the mainapps'
thank you for the fast reply. Your solution works like a charm!
I've been doing similar things before and it alwayes worked out of the box, but
with flex 4.1 we indeed need to include the marshaling support.
Drove me mad as i couldn't find any docs on this.