对象对象嵌入在组合框中的方括号中

时间:2011-08-14 14:06:16

标签: flash-builder

以下是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import mx.collections.ArrayCollection;
        import mx.utils.ArrayUtil;
        import mx.utils.ObjectUtil;

        [Bindable] 
            private var zipdataProvdr:ArrayCollection = new ArrayCollection([{name:           "test", file: "test"},{name: "elm34001", file: "elm34001"}, {name: "elm34003", file: "elm34003"}, {name: "elm34005", file: "elm34005"}, {name: "elm34009", file: "elm34009"},{name: "elm34011", file: "elm34011"}, {name: "elm34013", file: "elm34013"}]);
     ]]>
     </mx:Script>


     <mx:ComboBox  
         id="cbobxz" 
         dataProvider="{zipdataProvdr}"
         x="10" y="49" width="189" height="23">
     </mx:ComboBox>
     <mx:Label x="247" y="48" text="ShapeFiles" width="78" height="24"/>
     <mx:ComboBox x="350" y="50" id="cbobxs" dataProvider=""></mx:ComboBox>

         </mx:Application>

在浏览器上我应该看到一个下拉框,其中包含所有文件的名称,而我可以看到带有[object object]的下拉框。

1 个答案:

答案 0 :(得分:1)

您想要将代码更改为使用label而不是name

private var zipdataProvdr:ArrayCollection = new ArrayCollection([{label: "test", file: "test"},{label: "elm34001", etc.