0

I have observed unusual behaviour with the <mx:menubar> component of flex, I've created one from the examples found inside the Adobe documentation; and am receiving errors when clicking on or mousing over any menu item inside a debug flash player.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" preloader="pre.CLoader"
       xmlns:s="library://ns.adobe.com/flex/spark" width="720"
       xmlns:mx="library://ns.adobe.com/flex/mx" height="540">
    <fx:Script source="main.as"/>
    <mx:MenuBar id="topMenu" labelField="@label" width="100%">
        <fx:XMLList>
            <menuitem label="Kommunicate">
                <menuitem label="Connect"/>
                <menuitem type="separator"/>
                <menuitem label="Login" enabled="false"/>
                <menuitem label="Register" enabled="false"/>
            </menuitem>
            // ...
        </fx:XMLList>
    </mx:MenuBar>
</s:Application>

Error message when clicking on "Kommunicate":

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at mx.controls::Menu/updateDisplayList()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\Menu.as:1393]
    at mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\listClasses\ListBase.as:3963]
    at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:736]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:819]
    at mx.managers::LayoutManager/validateNow()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:878]
    at mx.controls::Menu/show()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\Menu.as:1706]
    at mx.controls::MenuBar/showMenu()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\MenuBar.as:1832]
    at mx.controls::MenuBar/mouseDownHandler()[E:\dev\4.5.1\frameworks\projects\mx\src\mx\controls\MenuBar.as:2025]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
    at mx.managers::SystemManager/mouseEventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2924]

Is it that Adobe is unable to create a usable framework? This is not the first time I've found unusual bits of their own code at fault when trying to develop and application that uses flex. Earlier it was using one of their Graphite CSS themese, where textareas had a hardcoded maximum width and height of 20px ...

ketan
  • 19,129
  • 42
  • 60
  • 98
cbroughton
  • 1,726
  • 1
  • 12
  • 19

1 Answers1

0

Answer: The new theme included in Flex4.5 / Flex4 sucks. (Not even kidding.)

The new Halo/Spark theme was causing this issue. When I reverted to the Flex3 one, it worked fine.

cbroughton
  • 1,726
  • 1
  • 12
  • 19
  • Can you please guide me to revert the theme.I using Adobe Flash Builder4.7 Trial Version. – GK_ Dec 19 '12 at 13:35