|
Dear Flexcoders, I encountered a strange issue today and would like to ask
you for any hints. However it is somewhat difficult to describe the scenario. I
give it a try: 1. In my application I have a MenuBar with a couple of
MenuItems and an EventHandler for the Menu. 2. The MenuBar EventHandler does nothing more than changing
the currentState of the application. 3. Once a specific MenuItem (e.g. Login) is selected, currentState
is set to a new value (e.g. “loginDataVisible”). 4. The state contains the following elements: <mx:State name="loginDataVisible"> <mx:AddChild target="{this}" position="firstChild"> <mx:Label text="Back" click="onLogin(event)"/> </mx:AddChild> </mx:State> With the onLogin Handler defined as follows: private function onLogin(e):Void { this.currentState="loggedOut"; } “loggedOut” is the initial (default) state. So the overall idea is: User starts with the main
application window (loggedOut state), select “Login” from the menu,
the “loginDataVisible” state is displayed, the user clicks on Back
and the main application window is restores. This works fine. HOWEVER: If I change the Label Control in the “loginDataVisible”
state to a Button control: <mx:State name="loginDataVisible"> <mx:AddChild target="{this}" position="firstChild"> <mx:Button label="Back" click="onLogin(event)"/> </mx:AddChild> </mx:State> I encounter a wired problem. When Login is selected in the
menu first, everything works fine. The new state is rendered, pressing the Back
button restores the original state. But if I then select the Login option from
the menu again, Flash responds with the following error: TypeError: Error #1009: null has no properties. at mx.core::UIComponent/focusInHandler() at mx.core::UIComponent/setFocus() at mx.managers::FocusManager/setFocus() at mx.managers::FocusManager/activate() at mx.managers::SystemManager/deactivate() at mx.managers::FocusManager/FocusManager$1683$private::hideHandler() at flash.events::EventDispatcher/dispatchEvent() at mx.controls::Menu/dispatchEvent() at mx.core::UIComponent/setVisible() at mx.core::UIComponent/set visible() at mx.controls::Menu/hide() at mx.controls::Menu/Menu$438$private::hideAllMenus() at mx.controls::Menu/mouseUpHandler() If I switch back to using a Label instead of a Button
everything works fine again. Your help is greatly appreciated. Best regards Ralf -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS
|
- [flexcoders] Strange Issue with Flex 2 Alpha States, MenuBar... Ralf Rottmann

