2 Replies Latest reply on Aug 6, 2009 4:02 AM by roshni79

    PopUpManager.centerPopUp gives Cannot access a property or method of a null object reference

    roshni79 Level 1

      Hello all,

       

      The PopUpManager.centerPopUp(this); in my code gives out the following error:

      Main Thread (Suspended: TypeError: Error #1009: Cannot access a property or method of a null object reference.)   
          mx.managers::PopUpManagerImpl/findPopupInfoByOwner   
          mx.managers::PopUpManagerImpl/centerPopUp   
          mx.managers::PopUpManager$/centerPopUp   
          com.mycom.view::LoginView/doInit   
          com.mycom.view::LoginView/___LoginView_TitleWindow1_creationComplete   
          flash.events::EventDispatcher/dispatchEventFunction [no source]   
          flash.events::EventDispatcher/dispatchEvent [no source]   
          mx.core::UIComponent/dispatchEvent   
          mx.core::UIComponent/set initialized   
          mx.managers::LayoutManager/doPhasedInstantiation   
          Function/http://adobe.com/AS3/2006/builtin::apply [no source]   
          mx.core::UIComponent/callLaterDispatcher2   
          mx.core::UIComponent/callLaterDispatcher

      MyAppl.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
          xmlns:view="com.mycom.view.*">
         
          <mx:Panel id="applPanel" height="100%" width="100%" backgroundColor="#3CACCC">
              <view:LoginView />
          </mx:Panel>
         
      </mx:Application>

      LoginView.mxml

      <?xml version="1.0" encoding="utf-8"?>
      <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
          layout="absolute" width="400" height="300" creationComplete="doInit()">
         
          <mx:Script>
              <![CDATA[
                  import mx.managers.PopUpManager;
                 
                  private function doInit():void {               
                      PopUpManager.centerPopUp(this);               
                  }
                 
                  private function login():void{
                      trace("login clicked");
                  }
                 
              ]]>
          </mx:Script>
         
          <mx:Form id="loginForm" defaultButton="{loginBtn}">               
              <mx:HBox>
                  <mx:Button id="loginBtn" label="OK" click="login()" />           
              </mx:HBox>
          </mx:Form>
         
      </mx:TitleWindow>

       

      Somebody please help me on this.
      Thanks.
      roshni