I saw this architecture and immediately said "Whoa, that's working against the PureMVC structure!", but I can't really explain *why*, other than saying "Commands are supposed to be stateless" which isn't much more than a statement of religious doctrine
public class FooCommand extends SimpleCommand {
private var fileTransfers:Array = [];
private var transfersComplete:int = 0;
override public function execute(notification:INotification):void {
//The following happens in a loop in the actual class:
var someFile:File = new File(someLocation);
//Logic to make sure the file exists goes here
//FileTransfer is a helper class that wraps FileStream logic for actually reading the file
var fileTransfer:FileTransfer = new FileTransfer(someUrl);
fileTransfer.addEventListener(FileTransfer.TRANSFER_ERROR, this.transferError);
fileTransfer.addEventListener(FileTransfer.TRANSFER_COMPLETE, this.transferComplete);
this.fileTransfers.push(fileTransfer);
}
private function transferError(event:Event):void {
sendNotification(MyFacade.ERROR_WITH_FILE_TRANSFER);
}
private function transferComplete(event:Event):void {
//Omitted logic making sure the fileTransfers array is empty
sendNotification(MyFacade.FILE_TRANSFERS_COMPLETE);
}
}