ReferenceError: Error #1069: No se encontró la propiedad idRutina en String y no hay ningún valor predeterminado.
at com.GymAdmin.command.Rutina::RutinaCommand$/addObjectsToModel()[C:\Users\Nico\Documents\Flex Builder 3\TrabajoConLasRutinasYSubRutinas\src\com\GymAdmin\command\Rutina\RutinaCommand.as:22]
at com.GymAdmin.command.Rutina::RutinaAgregarRutinaCommand/result()[C:\Users\Nico\Documents\Flex Builder 3\TrabajoConLasRutinasYSubRutinas\src\com\GymAdmin\command\Rutina\RutinaAgregarRutinaCommand.as:31]
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:199]
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:172]
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:193]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at NetConnectionMessageResponder/resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:515]
at mx.messaging::MessageResponder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199]
Clases involucradas:
Código ActionScript :
package com.GymAdmin.command.Rutina { import com.GymAdmin.model.AppModel; import com.GymAdmin.vo.RutinaVO; import mx.collections.ArrayCollection; public class RutinaCommand { private var _model:AppModel = AppModel.getInstance(); public static function addObjectsToModel( inArr:Array ):void { if( inArr == null || inArr[0] == null ) return; var _model:AppModel = AppModel.getInstance(); for( var i:int = 0; i < inArr.length; i++ ) { _model.rutinas.refresh(); var foundIndex:int = _model.rutinas .binarySearch( "idRutina" , inArr[i].idRutina); if (foundIndex >= 0 ) { _model.rutinas.getItemAt(foundIndex) .restore( inArr[i] ); } else { _model.rutinas.addItem( inArr[i] ); } } } } }
Y la otra:
Código ActionScript :
package com.GymAdmin.command.Rutina { import com.AM.lib.interfaces.IView; import com.GymAdmin.business.Rutina.RutinaAgregarRutinaDelegate; import com.GymAdmin.event.RutinaEvent; import com.GymAdmin.vo.RutinaVO; import com.adobe.cairngorm.commands.ICommand; import com.adobe.cairngorm.control.CairngormEvent; import mx.controls.Alert; import mx.rpc.IResponder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; public class RutinaAgregarRutinaCommand implements ICommand,IResponder { public function execute(event: CairngormEvent):void{ var clone: RutinaVO = (event as RutinaEvent).paramItem.store(); new RutinaAgregarRutinaDelegate(this).agregarRutina(event,clone); } public function fault(info:Object):void{ Alert.show(FaultEvent(info).fault.message); } public function result(data :Object):void{ var event:ResultEvent = ResultEvent( data ); if( event.result ) { RutinaCommand.addObjectsToModel( [event.result] ); if(event.token.originator.data is IView) event.token.originator.data.update(event.token.originator,event); Alert.show("La Rutina se ha agregado!"); } else { Alert.show( "No se pudo hacer la consulta.","Error" ); } } } }