3 Replies Latest reply on Aug 19, 2009 8:20 AM by matt_chotin

    Jump to a itemclick function

    ptharso

      We cannot do this code to work......Its possible????

       

       

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

      <mx:Application

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*

      "

      creationComplete="montar();"

      layout="

       

      vertical" backgroundGradientColors="#ffffff,#c0c0c0

      "

      width="

       

      100%" fontSize="11" cornerRadius="2"

      >

       

       

       

      <mx:MenuBar labelField="@label" itemClick=event.item.@data dataProvider="{option}"

      />

       

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      mx.controls.Alert;

       

       

      import

      mx.events.MenuEvent;

       

       

      import

      mx.collections.*;

       

       

       

       

       

      public function Abrir():void { Alert.show("Funcao Abrir"); }

       

       

      private function Salvar():void { Alert.show("Funcao Salvar");}

       

      [

       

      Bindable

      ]

       

       

      public var option:XMLListCollection; private var

      barras:XMLList ;

       

       

       

      private function montar():void

      {

      barras = <><menuitem label=

       

      "Arquivo" data="Arquivo()"><menuitem label="Abrir" data="Abrir()"/><menuitem label="Salvar" data="Salvar()"

      /></menuitem></>;

      option =

       

      new

      XMLListCollection(barras);

      }

      ]]>

       

       

      </mx:Script>

       

      </mx:Application>