Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
private function nextCommand ( shouldContinue:Boolean = true ) : void { if ( shouldContinue && subCommands.length > 0) { var commandClassRef:Class = subCommands.shift(); var commandInstance:Object = new commandClassRef(); var isAsync:Boolean = commandInstance is IAsyncCommand; if (isAsync) IAsyncCommand( commandInstance ).setOnComplete( nextCommand ); ICommand( commandInstance ).initializeNotifier( multitonKey ); ICommand( commandInstance ).execute( note ); if (!isAsync) nextCommand(); } else { if( onComplete != null ){ onComplete( shouldContinue ); } subCommands = []; note = null; onComplete = null; } }
/** * Notify the parent <code>AsyncMacroCommand</code> that this command is complete and it can continue the macro. */ protected function commandComplete () : void { onComplete( true ); } /** * Notify the parent <code>AsyncMacroCommand</code> that this command is complete but it should stop the macro. */ protected function stopMacro () : void { onComplete( false ); }