Perdon x Com pero no endendi lo uqe quiciste decir... el problema no es llamar mi remoteObject.. mi problema es que quiero llenar mis combos, mis grid y realizar todas las demas operaciones atraves de un solo remoteObject les pongo un ejemplo sobre lo que esoty haciendo
Código ActionScript :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="908.56067" height="584.6212" xmlns:ns1="myclass.*" xmlns:ns2="componentes.*">
<mx:Model id="modUserModel">
<usuario>
<ID>{grdDatosListaGrid.selectedItem.ID}</ID>
<nombre>{grdDatosListaGrid.selectedItem.nombre}</nombre>
<area>{grdDatosListaGrid.selectedItem.area}</area>
<nivel_acceso>{grdDatosListaGrid.selectedItem.nivel_acceso}</nivel_acceso>
<correo>{grdDatosListaGrid.selectedItem.correo}</correo>
<extencion>{grdDatosListaGrid.selectedItem.extencion}</extencion>
<usuario>{grdDatosListaGrid.selectedItem.usuario}</usuario>
<pass>{grdDatosListaGrid.selectedItem.pass}</pass>
</usuario>
</mx:Model>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
public var vLocationImg:String="http://localhost/common/img/";
public var oTarget:Object; //variable que sirve para albergar temporalmente las referencias al objeto
public var aryDatosListaGrid:ArrayCollection;
public var cDataProviderName:String;
public var aryDataProviders:Array=new Array([
{dProviderName:'mysDatosGrid'}, {dProviderName:'aryAreas'},{dProviderName:'aryNivelesAcceso'}
]);//declaracion de array que guarda los data providers
//----------------------
public function fcnFault(event:FaultEvent):void{
}
private function onResultService(event:ResultEvent,oTarget:Object,cNombreArray:String):void{
aryDataProviders[cNombreArray] = new ArrayCollection(event.result as Array);
oTarget.dataProvider=aryDataProviders[cNombreArray];
}
]]>
</mx:Script>
<mx:RemoteObject id="rOListaGrid"
destination="GenericDestination"
showBusyCursor="true"
source="queryssiodd"
result="onResultService(event,oTarget,cDataProviderName)"/>
<mx:Panel x="9.15" y="9" width="882.19696" height="554.3182" layout="absolute" id="panProductos" title="EMPLEADOS">
<mx:TabBar x="0" y="0" width="100%" height="28.030304" dataProvider="viewstack1">
</mx:TabBar>
<mx:ViewStack x="0" y="0" id="viewstack1" width="853.1061" height="493.10605">
<mx:Canvas label="DETALLE DE USUARIO" width="100%" height="100%">
<mx:Form x="17.9" y="48.15" width="811.51514" height="400">
<mx:FormItem label="Descripcion del Item">
<mx:TextInput width="590.1515" id="txtBuscar" height="20" change="cDataProviderName='mysDatosGrid',oTarget=grdDatosListaGrid,rOListaGrid.consulta('select * from user where nombre like \'%'+txtBuscar.text+'%\'')"/>
</mx:FormItem>
<mx:DataGrid width="772.4242" height="336.9697" id="grdDatosListaGrid" doubleClickEnabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Descripcion" dataField="nombre"/>
</mx:columns>
</mx:DataGrid>
</mx:Form>
<mx:Button x="579.15" y="450.7" label="Agregar" width="111.969696" height="37.42424" id="cmdNuevo"/>
<mx:Button x="698.7" y="451.65" label="Eliminar" width="111.969696" height="37.42424" id="cmdEliminar"/>
</mx:Canvas>
<mx:Canvas label="DETALLE DEL PRODUCTO O SERVICIO" width="100%" height="100%">
<mx:TabNavigator x="9.1" y="36.1" width="834.9242" height="447.95453">
<mx:Canvas label="Detalles" width="100%" height="100%">
<mx:Panel x="12" y="14" width="561.4394" height="386.51514" layout="absolute" borderStyle="inset">
<mx:Form x="9" y="22.8" width="519.1666" height="246.2">
<mx:FormItem label="Codigo " width="297">
<mx:TextInput id="ID" editable="false" text="{modUserModel.ID}"/>
</mx:FormItem>
<mx:FormItem width="483" height="26.89394" label="Nombre">
<mx:TextInput id="nombre" width="352.3485" height="21.969696" text="{modUserModel.nombre}"/>
</mx:FormItem>
<mx:FormItem label="Area">
<ns1:myComboBox id="area" labelField="nombre" width="160" height="21.969696"/>
</mx:FormItem>
<mx:FormItem label="Nivel de acceso">
<ns1:myComboBox id="nivel_acceso" labelField="descripcion"/>
</mx:FormItem>
<mx:FormItem label="Correo electronico" width="367.5" height="26.89394">
<mx:TextInput width="241.81818" height="21.969696" id="correo" text="{modUserModel.correo}"/>
</mx:FormItem>
<mx:FormItem label="Usuario" width="291" height="26.969696">
<mx:TextInput id="usuario" text="{modUserModel.usuario}"/>
</mx:FormItem>
<mx:FormItem label="Password" width="423" height="26.969696">
<mx:TextInput id="pass" text="{modUserModel.pass}" width="267"/>
</mx:FormItem>
</mx:Form>
<mx:Button x="443" y="285" label="Guardar" id="cmdGuardarCambios"/>
<mx:Button x="64.75" y="285" label="Button">
<mx:click>cDataProviderName='aryAreas',oTarget=area,rOListaGrid.consulta('select codigo,nombre from areas')</mx:click>
</mx:Button>
<mx:Button x="205.75" y="285" label="Button">
<mx:click>cDataProviderName='aryNivelesAcceso',oTarget=nivel_acceso,rOListaGrid.consulta('select nivel,descripcion from perfiles_usuarios')</mx:click>
</mx:Button>
</mx:Panel>
<mx:Panel x="586.25" y="13" width="220.45454" height="386.36365" layout="absolute">
<mx:Accordion x="8.95" y="9" width="183.36365" height="328.2273" openDuration="1000">
<mx:Canvas label="Imagen" width="100%" height="100%" id="aPanel1">
<mx:Button x="31.65" y="170.65" label="Asignar Imagen" id="cmdCargarImagen"/>
<ns2:myShowImg x="5" y="10" width="171.35" height="158" id="userImage" rutaImg="{vLocationImg+grdDatosListaGrid.selectedItem.fotografia}">
</ns2:myShowImg>
</mx:Canvas>
<mx:Canvas label="Grafica de uso" width="100%" height="100%">
</mx:Canvas>
<mx:Canvas label="detalle" width="100%" height="100%">
</mx:Canvas>
</mx:Accordion>
</mx:Panel>
</mx:Canvas>
</mx:TabNavigator>
</mx:Canvas>
</mx:ViewStack>
</mx:Panel>
</mx:Application>
como pueden ver tengo una funcion onResultService(event:ResultEvent,oTarget:Object,cNombreArray:String) que tiene como parametros el evento result un una variable Otarget que le dice a que objeto del form voy a asignar el dat provider y una varfiable tipo string donde le paso el elemento del array donde queiro que me cree el contenedor array para los datos que me regrese el remoteObject .
el problema es que las variables que le dicen a la funccion a que objeto va a ligar el dataProvider y el string que tendra el data provider que se crea en la funcion onResultService(). las seteo antes de realizar la llamada al servidor por medio del remoteObject de manera que cuando traigo los datos para un objeto a la ves no hay ningu problema..
cDataProviderName='aryAreas';
oTarget=area;
rOListaGrid.consulta('select codigo,nombre from areas');
todo funciona de maravilla pero cuando queiro llenar de datos varios objetos por ejemplo en el evento creationComplete y qeuiro qeu llene varios combos y uno que otro grid.. pues unicamente me llenda los datos del ultimo.
cDataProviderName='aryAreas';
oTarget=area;
rOListaGrid.consulta('select codigo,nombre from areas');
y luego
cDataProviderName='aryNivelesAcceso';
oTarget=nivel_acceso;
rOListaGrid.consulta('select nivel,descripcion from perfiles_usuarios');
por que ahun no termina de ejecutar la primera funcion cuando setea nuevamente los valors qeu sirvend e parametros para la funcion, entonces me devuelve los datos para el ultimo objeto indicado con el ultimo valor indicado por la variable oTarget.
espero esta ocacion haber explicado correctamente este problema , puesto qeu como se poco de el tema ya tnco casi un mes con el.. espero que explicandolo asi me puedan orientar..
gracias