6 Replies Latest reply on Nov 27, 2010 10:46 AM by Arnoud Bos

    Bug? PopupManager doesn't wor in swfLoader

    jackie1999
      In my main flex application main.swf, I use SwfLoader to load another flex application subApp.swf.

      In subApp.swf, there is button event to popup a TittleWindow.

      PopUpManager.createPopUp(this, MyTitleWindow, false);

      But I got and alert and the whole application got locked. Is it a bug or am I wrong?

      Here is the errors I got:
      "TypeError: Error #1009: Cannot access a property or method of a null object reference."

      Have you guys ever seen that before?

      Thanks,
      Jackie
        • 1. Re: Bug? PopupManager doesn't wor in swfLoader
          /usr/local/ΕΨΗΕΛΩΝ
          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.
          • 2. Re: Bug? PopupManager doesn't wor in swfLoader
            Arnoud Bos Level 1

            i posted details about a similar (same ?) issue here:

             

            http://forums.adobe.com/message/3299691#3299691

             

            It seems a bug to me ...

             

            Arnoud

            • 3. Re: Bug? PopupManager doesn't wor in swfLoader
              Flex harUI Adobe Employee

              Should be in the release notes that you have to force link PopUpManager into

              the main app in 4.x

              • 4. Re: Bug? PopupManager doesn't wor in swfLoader
                Arnoud Bos Level 1

                Hi Alex,

                 

                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.

                 

                see http://www.artim-interactive.nl/arnoud/popup_swfloader_problem_workspace.zip

                 

                1. download and extract
                2. open FlashBuilder4
                3. swich workspace to popup_swfloader_problem_workspace
                4. import existing projects into workspace, select the popup_swfloader_problem_workspace and all 4 projects inside
                5. look at the main app source: it force includes popup manager, also the alerts are working so this force include seems redundant anyway
                6. 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.)   
                    mx.managers::PopUpManagerImpl/addPopUp   
                    mx.managers::PopUpManager$/addPopUp   
                    mx.controls::Alert$/show   
                    SubApp/___SubApp_Button1_click 

                 

                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,
                                                className:Class,
                                                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.

                 

                thanx,

                 

                Arnoud

                • 5. Re: Bug? PopupManager doesn't wor in swfLoader
                  Flex harUI Adobe Employee

                  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'

                  popupmanager.

                  • 6. Re: Bug? PopupManager doesn't wor in swfLoader
                    Arnoud Bos Level 1

                    Hi Alex,

                     

                    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.

                     

                    thanx again!

                     

                    Arnoud