Estoy intentando hacer unos combos dependientes, pero tengo unos problemillas, al parecer la aplicación comienza ejecutandose bien, pero después empieza a fallar con solo algunos elementos identificados, el código con el que estoy trabajando es el siguiente:
Código :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="marcas.send()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var marca_ac:ArrayCollection;
[Bindable]
private var modelo_ac:ArrayCollection;
private function marcas_r(event:ResultEvent):void {
marca_ac = event.result.marcas.marca;
modelos.send();
}
private function modelos_r(event:ResultEvent):void {
modelo_ac = event.result.modelos.modelo;
}
]]>
</mx:Script>
<mx:HTTPService id="marcas"
url="http://localhost/flex/marcas.php"
useProxy="false"
result="marcas_r(event)">
</mx:HTTPService>
<mx:HTTPService id="modelos"
url="http://localhost/flex/modelos.php"
useProxy="false"
method="GET"
result="modelos_r(event)">
<mx:request xmlns="">
<id_marca>{marca_cb.selectedItem.id_marca}</id_marca>
</mx:request>
</mx:HTTPService>
<mx:Panel x="10" y="10" width="517" height="440" layout="absolute" title="data a combo">
<mx:ComboBox id="marca_cb" dataProvider="{marca_ac}" labelField="nombre" change="modelos.send()" x="10" y="10" width="150" height="20"/>
<mx:ComboBox id="modelo_cb" dataProvider="{modelo_ac}" labelField="nombre" x="10" y="38" width="150" height="20"/>
</mx:Panel>
</mx:Application>Cuando selecciono los elementos que me dan problemas, arroja el siguiente error:
Código :
TypeError: Error #1034: Error de conversión forzada: no se puede convertir mx.utils::ObjectProxy@5559601 en mx.collections.ArrayCollection. at CombosDependientes/::modelos_r() at CombosDependientes/__modelos_result() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent() at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler() at mx.rpc::Responder/result() at mx.rpc::AsyncRequest/acknowledge() at ::DirectHTTPMessageResponder/completeHandler() at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Como lo comentaba antes, solo sucede con algunos elementos, pero lo raro, es que todas las marcas tienen un modelo en la base de datos.
Desde ya, gracias!
Texto agregado como a la 1:28 PM GTM-6
Las cuatro marcas que mandan el error, solo tienen un (1) modelo, quiero pensar que eso esta afectando el resultado que recoge Flex, pues si veo los XML generados por PHP en el navegador, todo pinta muy bien.
Todavía no se como corregir eso.
