finalpublicdynamicclassGeneratorextendsProxy{privatevarenumerable:Function;privatevarvalue:*;privatevardone:Boolean=false;privatevarerror:Error;publicfunctionGenerator(enumerable:Function){this.enumerable=enumerable;}overrideflash_proxyfunctionnextValue(index:int):*{returnnewGeneratorResult(value,done);}overrideflash_proxyfunctionnextNameIndex(index:int):int{yield();returnint(!done);}publicfunctionnext(sent:*=undefined):GeneratorResult{yield(sent);returnnewGeneratorResult(value,done);}privatefunctionyield(sent:*=undefined):void{try{value=enumerable(sent);if(value==undefined){thrownewReferenceError("yield is not defined");}}catch(error:RangeError){done=true;value=null;}catch(error:*){done=true;value=null;this.error=error;}if(this.error){throwthis.error;}}}finalpublicclassGeneratorResult{privatevar_value:*;privatevar_done:Boolean;publicfunctionGeneratorResult(value:*,done:Boolean){_value=value;_done=done;}publicfunctiongetvalue():*{return_value;}publicfunctiongetdone():Boolean{return_done;}publicfunctiontoString():String{return"[value="+value+"; done="+done+"]";}}