8 Replies Latest reply on Jul 12, 2006 12:57 AM by TIPLVinay

    External XML as MenuBar dataProvider

    TIPLVinay
      Here the function called by application apps.mxml at initialization:-

      private function PopulateMenu ():void {
      request = new URLRequest('menusrc.xml');
      loader = new URLLoader();
      loader.load(request);
      menuLine.labelField = "@label";
      menuLine.iconField = "@Icon";
      menuLine.dataProvider = (new XML(loader.data));
      }

      apps.mxml:-
      <mx:MenuBar height="100%" id="menuLine" showRoot="false"/>

      menusrc.xml:-

      <?xml version="1.0" encoding="utf-8"?>
      <menu>

      <menuitem label="File">
      <menuitem label="Open" Icon="@Embed(source='images/menu/create.jpg')"/>
      <menuitem label="Delete"/>
      <menuitem label="Update"/>
      </menuitem>

      <!--Tree View-->
      <menuitem label="File">
      <menuitem label="Setting"/>
      </menuitem>
      </menu>

      The avobe is fails to populate my menu.


      Thanks in Advance!

      Vinay