Hi all,
I'm interesting to create a process (a function for example) and wait until it's finish in order to execute the second process (function). I want to achieve truly synchronous process especially for two consecutive events:
//In theory these events are not synchronous, right?? anObject1.fireEvent('eventName1'..); anObject2.fireEvent('eventName2'..);Example code to what i'm looking for:
*Note: The following example i don't know if works, i just made it up.
function doSomethin1(){ //blah blah } function doSomethin2(){ //blah blah } var procs = []; var procExecutionIndex = 0; procs.push(doSomethin1, doSomethin2); //Stores the pointer of the functions var waitReturnCode; var flag = false; while(true) { if (!flag) { flag = true; waitReturnCode = procs[procExecutionIndex](); } else { if (waitReturnCode != 'undefined') { if (++procExecutionIndex < procs.length) { flag = false; waitReturnCode = 'undefined';//a bit ugly hack but is just an example... } else { break; } } } }I'm using Ti Version 2.1.x and both Android (first) and iOS.
Thanks for any help.