I think that's a bug.  I'm not sure we did enough testing with
XMLListCollection with TabNav.  Try setting iconField to null as a
workaround.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Andrews
Sent: Monday, November 19, 2007 5:00 PM
To: [email protected]
Subject: [flexcoders] Flex TabBar is sniffy about my XMLListCollection
DataProvider.

 

Below is a test application. It runs without incident. If I remove the 
comment arround the second TabBar, then Bang! at runtime:

TypeError: Error #1034: Type Coercion failed: cannot convert
[EMAIL PROTECTED] 
to Class.
at mx.controls::NavBar/::createNavChildren()
at mx.controls::NavBar/mx.controls:NavBar::commitProperties()
at mx.controls::ButtonBar/mx.controls:ButtonBar::commitProperties()
at 
mx.controls::ToggleButtonBar/mx.controls:ToggleButtonBar::commitProperti
es()
at mx.core::UIComponent/validateProperties()
at mx.managers::LayoutManager/::validateProperties()
at mx.managers::LayoutManager/::doPhasedInstantiation()
at Function/http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> ()
at mx.core::UIComponent/::callLaterDispatcher2()
at mx.core::UIComponent/::callLaterDispatcher()

Someone please tell me why the second TabBar has a problem. I'm
anticipating 
a Doh! moment.

Paul

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="vertical"
initialize="init()" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;

[Bindable]
public var myXML:XML =
<a>
<b label="L1">
<q>Q1</q>
</b>
<b label="L2">
<q>Q2</q>
</b>
</a>;

[Bindable]
public var my:XMLListCollection ;

[Bindable]
public var myArrColl:ArrayCollection =
new ArrayCollection([{label:"L1", q:"Q1"},{label:"L2", q:"Q2"}]);

public function init():void {
my = new XMLListCollection(myXML.children());
}
]]>
</mx:Script>

<!-- ArrayCollection version -->

<mx:TabBar dataProvider="{myArrColl}" labelField="label" />
<mx:DataGrid dataProvider="{myArrColl}" >
<mx:columns>
<mx:DataGridColumn dataField="label" />
<mx:DataGridColumn dataField="q" />
</mx:columns>
</mx:DataGrid>

<!-- XML version -->

<!-- if this comment is removed, Flex is unhappy..
<mx:TabBar dataProvider="{my}" labelField="@label" />
..but why? -->
<mx:DataGrid dataProvider="{my}" >
<mx:columns>
<mx:DataGridColumn dataField="@label" />
<mx:DataGridColumn dataField="q" />
</mx:columns>
</mx:DataGrid>
</mx:Application> 

 

Reply via email to