Estudando - DataProvider -

1 view
Skip to first unread message

Joao Batista Guimaraes Filho

unread,
May 19, 2011, 2:41:55 PM5/19/11
to
Pessoal, estou estudando aqui o DataProvider, escrevi um exemplo aqui, mais não esta rodando. Alguém pode me ajudar?

-------------------------------------------


<?xml version="1.0" encoding="utf-8"?>
<s:Application      xmlns:fx="http://ns.adobe.com/mxml/2009
  xmlns:s="library://ns.adobe.com/flex/spark
  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<fx:Array id="estados">
<fx:String>Paraiba</fx:String>
<fx:String>Pernambuco</fx:String>
<fx:String>Paraná</fx:String>
<fx:String>Bahia</fx:String>
<fx:String>Acre</fx:String>
</fx:Array>
<fx:Array id="cidades_pb">
<fx:String>João Pessoa</fx:String>
<fx:String>Patos</fx:String>
</fx:Array>
<fx:Array id="cidades_pe">
<fx:String>Recife</fx:String>
<fx:String>Juazeiro</fx:String>
</fx:Array>
<fx:Array id="cidades_pr">
<fx:String>x y z</fx:String>
<fx:String>z y x</fx:String>
</fx:Array>
<fx:Array id="cidades_ba">
<fx:String>Salvador</fx:String>
<fx:String>Juazeiro do Norte</fx:String>
</fx:Array>

</fx:Declarations> 

<s:Panel x="145" y="73" width="543" height="383" title="Filtrando dados com Array">
<s:Label x="81" y="66" text="Lista de Estados.:"/>
<s:Label x="81" y="118" text="Lista de Cidades.:"/>
<s:ComboBox id="ComboEstados" dataProvider="{estados}" x="206" y="55" width="206" change="filtraCidadePorEstado();"/>
<s:ComboBox id="ComboCidades" dataProvider="{cidades_pb}" x="206" y="112" width="206"/>
<fx:Script>
<![CDATA[
private function filtraCidadePorEstado():void
{
if (ComboEstados.selectedIndex == 0)
ComboCidades.dataProvider = cidades_pb;
else if (ComboEstados.selectedIndex == 1)
ComboCidades.dataProvider = cidades_pe;
else if (ComboEstados.selectedIndex == 2)
ComboCidades.dataProvider = cidades_pr;
else if (ComboEstados.selectedIndex == 3)
ComboCidades.dataProvider = cidades_ba;
}
]]>
</fx:Script>
</s:Panel>
</s:Application>

A mensagem de erro que aparece é: Description Resource Path Location Type
1067: Implicit coercion of a value of type Array to an unrelated type mx.collections:IList. main.mxml /filtragemDados/src line 44 Flex Problem


--
João Batista Guimarães Filho
(83) 8889-8431
skype: guimaraes.filho
http://twitter.com/jbguimaraesf
http://lattes.cnpq.br/7458628652724314




Reply all
Reply to author
Forward
0 new messages