Skip navigation
Currently Being Moderated

FocusManager generates error

Mar 31, 2010 8:07 AM

I get this error when trying to close a title window.

 

TypeError: Error #1009: Cannot access a property or method of a null  object reference.
    at  mx.managers::FocusManager/childHideHandler()[E:\dev\4.0.0\frameworks\ projects\framework\src\mx\managers\FocusManager.as:1744]
     at flash.events::EventDispatcher/dispatchEventFunction()
    at  flash.events::EventDispatcher/dispatchEvent()
    at  mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects \framework\src\mx\core\UIComponent.as:12269]
     at  mx.core::UIComponent/setVisible()[E:\dev\4.0.0\frameworks\projects\fr amework\src\mx\core\UIComponent.as:3038]
     at mx.core::UIComponent/set  visible()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UICo mponent.as:2997]
     at  mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewSkinForPhase()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.a s:1953]
     at  mx.controls::PopUpButton/http://www.adobe.com/2006/flex/mx/internal::viewSkin()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\PopUpBut ton.as:712]
     at  mx.controls::Button/updateDisplayList()[E:\dev\4.0.0\frameworks\proje cts\framework\src\mx\controls\Button.as:1754]
     at  mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\pr ojects\framework\src\mx\core\UIComponent.as:8531]
     at  mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\framewo rks\projects\framework\src\mx\managers\LayoutManager.as:663]
     at  mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frame works\projects\framework\src\mx\managers\LayoutManager.as:736]
     at  mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0 .0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072 ]

 

The line this is breaking on is

 

DisplayObject(form).stage.focus = null;

 

in the FocusManager, the stage is null

 

 

the window is opened by the following

 

                window= PopUpManager.createPopUp(this,ProductSearch,true) as ProductSearch;
                window.addEventListener("loaded" , onWindowLoad );
                window.addEventListener("close"  , closeWindow );
                window.title = "Add Product - [ESC to close]"
                window.closeButton.visible = false;

 

                window.width = stage.width * 0.75;
                window.height = stage.height * 0.65;
                   
                var pt:Point = new Point(0, 0);
                pt = stage.localToGlobal(pt);
                pt = window.globalToLocal(pt);
                window.move(Math.round((stage.width - window.width) / 2) + pt.x, Math.round((stage.height - window.height) / 2) + pt.y);                   
               
                CursorManager.setBusyCursor();

 

 

and cloesed by

 

PopUpManager.removePopUp(window);

 

 

it is on the remove pop up call that it errors, if i comment it out then the window doesn't close and i don't get an error

 

Help please

 

ps i have other title window that close using this method just fine

 
Replies
  • Currently Being Moderated
    Mar 31, 2010 9:52 AM   in reply to JockMahon

    That's a bug.

     

    You can try to workaround by setting closebutton.visible=false in the

    ProductSearch component.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 1, 2010 9:05 AM   in reply to JockMahon

    Yeah, but it looked like you're doing that after the popup is created.  I'm

    suggesting you try doing that in the popup definition.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 1, 2010 11:05 AM   in reply to JockMahon

    Try using the initialize event instead of creationComplete.

     

    If that still fails, can you post a simple test case?  BTW, the TitleWindow

    should not implement IFocusManagerComponent.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2010 10:37 AM   in reply to JockMahon

    Nothing wrong.  It is a bug and I'm trying to find you a workaround.  An

    example will definitely help.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 5, 2010 7:39 AM   in reply to JockMahon

    I got the same exception. I have a TitleWindow that contains a list with a custom itemRenderer; each item had a dropdownlist component which when opened along with removal of the popup threw this exception. After long furstrating investigation I came to a simple solution of setting the dropdownlist focuseEnabled property to false. That put it out of the game.

    I believe that this is an Adobe Bug.

    Hope it helps

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 6:35 AM   in reply to JockMahon

    I have got the same exception. I have a Title Window that contains a tabNavigator that contains a list with a custom itemRenderer. Each Item have a graph and a legend that describes the graph. In the legend I have put a certain number of checkbox. If I select a checkbox and then I close the Title Window i have the exception. If I don't checked the any checkbox I don't have the exception.

    I put for every checkbox the property focusEnabled=false and I don't get any error.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points