how to wait multiple function processing to finish

Posted by user351412 on Stack Overflow See other posts from Stack Overflow or by user351412
Published on 2010-05-26T21:35:50Z Indexed on 2010/05/27 9:31 UTC
Read the original article Hit count: 208

Filed under:

I have a problem about multiple function processing , listed as below code,

the main function is btnEvalClick, I have try to use alter native 1and 2 to wait the function not move to next record before theprocessed function finish, but it does not work

//private function btnEvalClick(event:Event):void {  

// var i:int;
// for(i= 0; i < (dataArr1.length); i++) {

// dispatchEvent( new FlexEvent('test') );

// callfunc1('cydatGMX'); //call function 1
// callfun2('cydatGMO');  //call function 1
// editSave();    //save record (HTTP)


//## Alternative 1
 //if (String(event) == 'SAVEOK') {
 // RecMov('next');  //move record if save = OK
 //}

//## Alternative 2
 //while (waitfc == '')   // if waitfc not 'OK' continue looping
 //{
 //    z = z + 1;
 //}


// RecMov('next');  //Move to next record to process

//}


//private function callfunc1(tasal:String):void {
// var mySO :SharedObject;
// var myDP: Array;
// var i:int;
// var prm:Array;

// try
//    {

// mySO = SharedObject.getLocal(tasal,'/');
// prm = mySO.data.txt.split('?');  

// for(i=0; i < (prm.length - 1); i++) {
//  myDP = prm[i].toString().split('^'); 

//  if ( myDP[0].toString() == String(dataArr1[dg].MatrixCDCol)){  
//   myDPX = myDP;
//   break;
//  } 

// } 

// }
//    catch (err:Error) {
//     Alert.show('Limit object creation fail (' + tasal + '), please retry );
//    }

//}


//private function editSave():void
//{

//    var parameters:* =
//       {

//          'CertID': CertIDCol.text, 'AssetID': AssetIDCol.text, 'CertDate': cdt, //'Ccatat': CcatatCol.text, 'CertBy': CertByCol.text, 'StatusID': StatusIDCol.text, //'UpdDate': lele, 'UpdUsr': ApplicationState.instance.luNm };

//       doRequest('Update', parameters, saveItemHandler);  

//}

//private function doRequest(method_name:String, parameters:Object, callback:Function):void
//  {
      // add the method to the parameters list
//      parameters['method'] = (method_name + 'ASC');

//      gateway.request = parameters;

//      var call:AsyncToken = gateway.send();
//      call.request_params = gateway.request;

//      call.handler = callback;

//  }


//private function saveItemHandler(e:Object):void
//  {
//      if (e.isError)
//      {
//          Alert.show('Error: ' + e.data.error);
//      }
//      else
//      {
//       Alert.show('Record Saved..');
//   waitfc = 'OK';
//   dispatchEvent( new FlexEvent('SAVEOK') );
//      }     
//  } 

© Stack Overflow or respective owner

Related posts about flex