I'm converting an average size app to Flex 4 and right around the time
I switched to the default spark theme (from the halo theme) I started
getting errors on all of my buttons.

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:12266]
        at 
mx.core::UIComponent/setVisible()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:3038]
        at mx.core::UIComponent/set
visible()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.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.as:1953]
        at 
mx.controls::Button/http://www.adobe.com/2006/flex/mx/internal::viewSkin()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.as:1869]
        at 
mx.controls::Button/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\controls\Button.as:1754]
        at 
mx.core::UIComponent/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8531]
        at 
mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:663]
        at 
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
        at mx.managers::LayoutManager/doPhasedInstantiationCallb


It breaks on this line (the stage is null):
->            DisplayObject(form).stage.focus = null;

FocusManager.as:
    private function childHideHandler(event:Event):void
    {
        var target:DisplayObject = DisplayObject(event.target);
        // trace("FocusManager focusInHandler in  = " +
this._form.systemManager.loaderInfo.url);
        // trace("FM " + this + " focusInHandler " + target);

        if (lastFocus && !isEnabledAndVisible(DisplayObject(lastFocus)))
        {
            DisplayObject(form).stage.focus = null;
            lastFocus = null;
        }
    }

Reply via email to