2008-08-08 15 views
7

¿Alguien sabe por qué cuando se utiliza BindingUtils en la propiedad selectedItem de un cuadro combinado se obtiene la siguiente advertencia? ¿Alguna idea de cómo resolver el problema?¿Cómo deshacerse de la advertencia "múltiples entradas describeType"?

La unión sigue funcionando correctamente, pero sería bueno para deshacerse de la advertencia.

warning: multiple describeType entries for 'selectedItem' on type 'mx.controls::ComboBox': 
<accessor name="selectedItem" access="readwrite" type="Object" declaredBy="mx.controls::ComboBase"> 
    <metadata name="Bindable"> 
    <arg key="" value="valueCommit"/> 
    </metadata> 

Respuesta

0

Aquí está el código. Es básicamente una copia de BindingUtils.bindProperty de que se configura por un ComboBox de modo que tanto el cuadro combinado y el modelo se actualizan cuando ninguno de los dos cambios.

public static function bindProperty2(site:Object, prop:String, host:Object, chain:Object, commitOnly:Boolean = false):ChangeWatcher 
{ 
    var cbx:ComboBox = null; 
    if (site is ComboBox) { cbx = ComboBox(site); } 
    if (host is ComboBox) { cbx = ComboBox(host); } 
    var labelField:String = "listID"; 

    var w:ChangeWatcher = ChangeWatcher.watch(host, chain, null, commitOnly); 

    if (w != null) 
    { 
     var func:Function; 

     if (site is ComboBox) 
     { 
      func = function(event:*):void 
      { 
       var dp:ICollectionView = ICollectionView(site.dataProvider); 
       var selItem:Object = null; 

       for (var i:int=0; i<dp.length; i++) 
       { 
        var obj:Object = dp[i]; 
        if (obj.hasOwnProperty(labelField)) 
        { 
         var val:String = String(obj[labelField]); 
         if (val == w.getValue()) 
         { 
          selItem = obj; 
          break; 
         } 
        } 
       } 

       site.selectedItem = selItem; 
      }; 

      w.setHandler(func); 
      func(null); 
     } 
     else 
     { 
      func = function(event:*):void 
      { 
       var value:Object = w.getValue(); 
       if (value == null) 
       { 
        site[prop] = null; 
       } 
       else 
       { 
        site[prop] = String(w.getValue()[labelField]); 
       } 
      }; 
      w.setHandler(func); 
      func(null); 
     } 
    } 

    return w; 
} 
+0

esto no parece ser una respuesta a la pregunta – rfunduk

1

Sería mejor anular la propiedad en cuestión y declararla definitiva.

Cuestiones relacionadas