This content has been marked as final. Show 2 replies
Many MXML tags have a "default property," which means, whenever you write
that that is equivalent to writing
which is also equivalent to writing
<mx:SomeTag DEFAULT_PROPERTY="anything here" />
This may seem odd at first, but the idea is to provide a convenient shorthand
for common operations. In the case of a ComboBox, for example, since the
default property is dataProvider, the following are equivalent:
<!-- case one: data separate from the combo box -->
<mx:ComboBox dataProvider="myData" />
<!-- case two: data inside the combo box, explicitly specified
as being the data provider -->
<mx:dataProvider> <!-- lower case 'd' -->
<!-- case two: data inside the combo box; since dataProvider
is the default property of ComboBox, you don't have to
explicitly specify mx:dataProvider tag -->
That's why the compiler complains when you write a ComboBox with both a
dataProvider attribute and child tag which are not explicitly specified as
being some other property.
So, how do you fix it? Like this:
Later, from code, to get the rest of the data in the currently selected item,
Developer, Flex Builder team
> I'm just learning Flex. Decided to learn v2. I'm trying to populate a ComboBox
> from the data returned from a web service. I've spent hours looking through the
> docs and examples, but have not been able to find any help or examples. Has
> anyone done this, and could you provide me a couple of examples and possibly
> some help? Below are snippits of my code.
> The web service is a CF web service that returns a query with one field (name)
> in each record. I've tested it witn CFML so I know that it works. Also, I've
> been able to populate a DataGrid with it.
> <mx:WebService id="wsDSNinfo"
> wsdl="<a target=_blank
> href=" http://localhost:8500/test/DSNinfo/DSNinfo.cfc?wsdl"
> "> http://localhost:8500/test/DSNinfo/DSNinfo.cfc?wsdl"
> </a> useProxy="false"
> <mx:operation name="getDSNinfo"></mx:operation>
> <mx:operation name="VerifyDSN"></mx:operation>
> <mx:operation name="getTables">
> <mx:operation name="getTableDetails"></mx:operation>
> <mx:operation name="getTableRecords"></mx:operation>
> <mx:ComboBox x="10" y="10" id="cbxTables"
> <mx:Object label="Name" data="name" />
> Here's the error I get in Developer.
> "Multiple initializers for property 'dataProvider'. (note:
> 'dataProvider' is the default property of 'mx.controls.ComboBox')."
> I have an idea of what's going on, but havn't been able to discover how to fix
> Thanks for any help you can give.
> Sincerely: Phil Spingola
Thanks much Mike. That worked. The only think different that I had to do was to type the labelField value ,"NAME" in caps. I'm finding that the existing doc is not really helping me very much. Is this just me, or are there clearer docs on the way. Your explanation was very clear and helpful.