This error is thrown in only debugger not in console.

But this exception does not prevent the menu to be constructed.

I discovered that it is because of the inline xml which has no root element. When i add root element the exception goes away.

But this time the menu is not constructed.

So I replaced the line

menuBarData.source = menuDataXMLList;

with the line

menuBarData.source = menuDataXMLList.children();

To make it work again.

I guess it should not be required to get the children of the xml for setting the menu data.

Is there something to be fixed on XML parsing of menu component ?

Thanks,
Serkan

Source :

<?xml version="1.0" encoding="latin5" ?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
               xmlns:s="library://ns.apache.org/royale/spark"
               xmlns:mx="library://ns.apache.org/royale/mx"
               height="288" width="179"
               >

    <fx:Script>
        <![CDATA[
            import mx.collections.XMLListCollection;
            import mx.events.FlexEvent;
            import mx.collections.XMLListCollection;
            import mx.events.MenuEvent;
            import mx.controls.Menu;

            [Bindable]
            public var menuBarData:XMLListCollection = new XMLListCollection();

            protected function pinaraMenuBar_creationCompleteHandler(event:FlexEvent):void
            {
                var tmpXmlList:XMLListCollection = new XMLListCollection();
                menuBarData.source = menuDataXMLList;
                menuBarData.refresh();
            }


            protected function tlosMenuBar_itemClickHandler(event:MenuEvent):void {

            }

        ]]>
    </fx:Script>

    <fx:Declarations>
        <fx:XMLList id="menuDataXMLList">
            <menuroot>
                <menuitem label="configFiles" id="configfiles">
                    <menuitem label="pinaraProperties" id="pinaraProperties"/>
                </menuitem>
                <menuitem label="management" id="admin">
                    <menuitem label="suspendApp" id="suspendApp"/>
                </menuitem>
            </menuroot>
        </fx:XMLList>
    </fx:Declarations>

    <mx:MenuBar id="pinaraMenuBar" width="100%" color="#0D173C"
                dataProvider="{menuBarData}" fontFamily="Arial" fontWeight="bold" horizontalCenter="0"
                itemClick="tlosMenuBar_itemClickHandler(event)"
                labelField="@label"
creationComplete="pinaraMenuBar_creationCompleteHandler(event)"/>


</s:Application>



Reply via email to