7 Replies Latest reply on May 1, 2010 12:33 AM by Loic.Aigon

    object icon in Array for dataProvider of a ComboBox

    Loic.Aigon Adobe Community Professional

      Hi,

       

      I am trying to get a ComboBox whose items consist in a label and an icon.

       

      If I place static code, it runs well, I get my icon and label.

       

      http://j.imagehost.org/0018/dataProvider_manuel.png

      <mx:ComboBox ... >
          <mx:dataProvider>
              <mx:Array>
               <mx:Object label="Français" icon="@Embed(source='assets/pays/France.png')" />
              </mx:Array>
          </mx:dataProvider>
      </mx:ComboBox>     
      

       

       

      BUT if I try to get it dynamically, I can get nothing but the labels :

       

      http://j.imagehost.org/0180/dataProvider_function.png

      <mx:ComboBox ... dataProvider="{getlanguages()}"/>

      and here is my  function getlanguages() :

      public function getlanguages():Array{
      
           var myList:Array=["France"];
           var lang:Array = [];
      
           for(var i:int = 0; i<myList.length; i++){
                var theLanguage:Object= {
                          label:myList[i],
                          icon:"@Embed(source='assets/pays/France.png')"
                          };
                lang.push(theLanguage);
      
           }
           return lang;
      }
      

       

      Any  ideas why ?

       

      TIA Loic