Please file a bug.
My suspicion is that the binding is evaluated when manager is null so it throws
an error and does not set visible to false right away. I would try to re-work
your visible logic so the expression is always valid. Maybe:
vlsible=”{manager != null && manager.isFirstLogin}”
On 3/27/10 3:42 PM, "[email protected]"
<[email protected]> wrote:
During startup. I think it has to do with when a component is not completely
created and then it's told to be hidden and the stage property is still null.
For example here is some of the code I'm working with,
<mx:Canvas id="postBubble"
buttonMode="true"
useHandCursor="true"
mouseChildren="false"
click="collapse(postBubble)"
visible="{manager.isFirstLogin}"
includeInLayout="{manager.isFirstLogin}"
width="359"
height="319"
top="35"
right="100"
showEffect="{fadeInShort}"
creationCompleteEffect="{fadeInShort}"
filters="{[dropShadow1]}">
<mx:Image source="assets/images/bubbles/step4.png" />
<mx:Image source="assets/images/bubbles/close_button.png" left="12"
top="143" click="collapse(postBubble)"/>
</mx:Canvas>
This is the line the error is on:
DisplayObject(form).stage.focus = null;
"stage" is null thus throwing the error when trying to access "focus".
On Sat, Mar 27, 2010 at 2:57 PM, Alex Harui <[email protected]> wrote:
Are you saying you get this error when you click a button?
On 3/27/10 1:49 PM, "[email protected]
<http://[email protected]> " <[email protected]
<http://[email protected]> > wrote:
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;
}
}
--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui