0 Replies Latest reply on May 5, 2010 10:29 PM by Ling's

    how to binding in menubar iconfield dynamic..?

    Ling's Level 1

      Hi

       

               I am using menubar iconfield., icon is  url come from coldfusion data files to binding in flex menubar., dataprovider, labelfiled are working perpectly.,

      but  iconfiled not working below the code..

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                     creationComplete="initLogonOptions(event)">
         
          <fx:Declarations>
         
              <s:RemoteObject destination="ColdFusion" id="LogonOptionsCFC" source="IST_Auth.logon.logon_optionscfc">
              <s:method name="fnGetLogonOptions" fault="handleGetLogonOptionsFault(event)" result="handleGetLogonOptionsResult(event)"/>
              </s:RemoteObject>
             
          </fx:Declarations>
         
          <fx:Script>
              <![CDATA[
                
                 
              
                 
                  import spark.components.Label;
                 
                 
                  [Bindable]
                  private var Datamenu:ArrayCollection;
                 
                  function initLogonOptions(event):void
                  {
                      LogonOptionsCFC.fnGetLogonOptions();
                  }
                 
                  function handleGetLogonOptionsFault(evt): void
                  {
                      mx.controls.Alert.show(evt.fault.faultString) ;
                  }
                 
                          
                 
                  function handleGetLogonOptionsResult(evt): void
                  {
                      if (evt.result)
                         
                      {
                          var resultArray:Array = evt.result ;
                          var menuCollection:ArrayCollection = new ArrayCollection() ;
                          var i:int=0;
                          var menuimage:Image;
                         
                          for ( ; i < resultArray.length ; i++)
                          {
                              var menulabel:String =   resultArray[i].MenuLabel ;
                              var menutooltip:String = resultArray[i].MenuTooltip ;
                              var menuaction:String = resultArray[i].MenuAction ;
                              var menuicon:String =   resultArray[i].MenuIcon ;
                              var menutarget:String = resultArray[i].MenuTarget ;
                              var menutargetwidth:String = resultArray[i].MenuTargetWidth ;
                              var menutargetheight:String = resultArray[i].MenuTargetHeight ;
                             
                              var  currentMenu:ISTMenu = new ISTMenu(menulabel, menutooltip, menuaction, menuicon, menutarget, menutargetwidth, menutargetheight, constructISTMenu(resultArray[i].Children))
                             
                              menuCollection.addItem(currentMenu);
                          }
                         
                          Datamenu = menuCollection ;
                     
                      }
                      else
                      {
                          mx.controls.Alert.show(evt.fault.faultString) ;     
                      }
                  }
                 
                  public function Select_MenuBar(event:MouseEvent):void
                  {
                  
                          var tempMenu:MenuBarItem =MenuBarItem(event.target);
                          var loc_menuaction:String=tempMenu.data.menuAction;
                          var urlmenu:URLRequest= new URLRequest(loc_menuaction);
                          navigateToURL(urlmenu);
                    
                  }
                 
                  public function ClickMenuItem(event:MenuEvent):void
                  {
                      var loc_menuaction:String=event.item.menuAction;
                      var urlmenu:URLRequest= new URLRequest(loc_menuaction);
                      navigateToURL(urlmenu);
                     
                  }
                 
         
                 
              ]]>
          </fx:Script>
         
          <s:HGroup paddingLeft="10" paddingRight="20" paddingTop="20" width="100%" height="100%">
             
          <mx:MenuBar id="testmenu"   labelField="menuLabel"  iconField="menuIcon"  dataProvider="{Datamenu}" width="100%" itemClick="ClickMenuItem(event);" click="Select_MenuBar(event);" >


             
              </mx:MenuBar>
          </s:HGroup>
      </s:Application>

       

       

       

      any one help me....

       

      With Regards.,

       

      LinFlex-