6 Replies Latest reply on Feb 5, 2011 1:25 AM by FlippieScholtz

    PopUpManager problem

    FlippieScholtz

      Hi

       

      I am getting a weird error when trying to call addPopup() to add a custom popup. It's been working the whole time until I made some minor changes today that broke it, and now I can't seem to get it back in working order.

       

      My code (fired on button click to open popup):

       

       

       

       

       

       

      function openActionPopup(userObj:Object):void {

           var actionPopup:ViewEditDeletePopup = new  ViewEditDeletePopup();

            PopUpManager.addPopUp(actionPopup, this); 

      }   

       

      And in ViewEditDeletePopup.mxml I just have a Panel, which contains an HBox, which in turn contains 3 buttons.

      When addPopUp is called, I get the following error: (apart from the error, the popup opens correctly and is completely functional. It's just the error that pops up every time.) My popup mxml does implement IFlexDisplayObject. It's funny because I have another popup elsewhere in the app that I create in the exact same way, but it does not produce the error. However, replacing the ViewEditDeletePopup.mxml with the other popup also doesn't work. I think the problem lies within PopUpManager itself.

      The error:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.x\frameworks\projects\framework\src\mx\ managers\PopUpManagerImpl.as:434]
      at mx.managers::PopUpManager$/addPopUp()[E:\dev\4.x\frameworks\projects\framework\src\mx\man agers\PopUpManager.as:193]
      at com.SecSA.employeesHR.views::ViewEmployees/openActionPopup()[C:\wamp\www\SecSAView\src\co m\SecSA\employeesHR\views\ViewEmployees.mxml:35]
      at com.SecSA.employeesHR.views::ViewEmployees/__employeeGrid_itemClick()[C:\wamp\www\SecSAVi ew\src\com\SecSA\employeesHR\views\ViewEmployees.mxml:93]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[E:\dev\4.x\frameworks\projects\framework\src\mx\core \UIComponent.as:12528]
      at mx.controls.listClasses::ListBase/mouseClickHandler()[E:\dev\4.x\frameworks\projects\fram ework\src\mx\controls\listClasses\ListBase.as:10319]

       

      What could I be missing?

      Thanks!

        • 1. Re: PopUpManager problem
          UbuntuPenguin Level 4

          I looked at the source code for where it says it is failing.  It has to do with the ActiveWindowManager and I don't really know what that means.  So lets try using another classs for the parent.  Replace "this" with "FlexGlobals.topLevelApplication as DisplayObject" and lets see if it has to do with the parent or some other function.

          • 2. Re: PopUpManager problem
            FlippieScholtz Level 1

             

            Hi UbuntuPenguin

             

            I tried what you suggested, but I still get the same error.

             

            Also, if I remove the popup later by calling PopUpManager.removePopUp(this); from inside the popup, I get the following error with the same theme:

             

            TypeError: Error #1009: Cannot access a property or method of a null object reference.

            at mx.managers::PopUpManagerImpl/popupRemovedHandler()[E:\dev\4.x\frameworks\projects\framew ork\src\mx\managers\PopUpManagerImpl.as:1149]

            at flash.display::DisplayObjectContainer/removeChild()

            at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_removeChild()[E:\dev\4.x\framework s\projects\framework\src\mx\managers\SystemManager.as:1974]

            at mx.managers::SystemManager/removeChild()[E:\dev\4.x\frameworks\projects\framework\src\mx\ managers\SystemManager.as:1629]

            at mx.managers::PopUpManagerImpl/removePopUp()[E:\dev\4.x\frameworks\projects\framework\src\ mx\managers\PopUpManagerImpl.as:606]

            at mx.managers::PopUpManager$/removePopUp()[E:\dev\4.x\frameworks\projects\framework\src\mx\ managers\PopUpManager.as:230]

            at com.SecSA.employeesHR.views::ViewEditDeletePopup/viewEmployee()[C:\wamp\www\SecSAView\src \com\SecSA\employeesHR\views\ViewEditDeletePopup.mxml:17]

            at com.SecSA.employeesHR.views::ViewEditDeletePopup/___ViewEditDeletePopup_Button1_click()[C :\wamp\www\SecSAView\src\com\SecSA\employeesHR\views\ViewEditDeletePopup.mxml:30]

             

             

             

            Like I said, the popup works perfectly otherwise. If I run it in a browser that suppresses AS errors, I wouldn't even know about the problem. Just the error popping up.

             

            Thanks

             

            • 3. Re: PopUpManager problem
              UbuntuPenguin Level 4

              NPEs are usually pretty easy to solve, but since this one is happening in a source file I rarely have to venture into, I'm not gonna be of much help.  You might have to wait for Alex or Gordon to come by.

              1 person found this helpful
              • 4. Re: PopUpManager problem
                Darrell Loverin Level 4

                The most likely problem is that you need to define PopUpManager (import mx.managers.PopUpManager; PopUpManager) in your main application. I'm assuming this problem only happens in modules or sub-applications.

                 

                 

                -Darrell

                • 5. Re: PopUpManager problem
                  Flex harUI Adobe Employee

                  Do you have more than one SWF?  The main one might need to have PopUpManager

                  linked in.

                   

                      import mx.managers.PopUpManager; PopUpManager; // force link

                  PopUpManager;

                  1 person found this helpful
                  • 6. Re: PopUpManager problem
                    FlippieScholtz Level 1

                    Thanks!

                    This fixed the problem.