import E3DPack.*; import eQueue.*; #include "Ulti.as" #include "gData.as" #include "LSystem.as" /*Core Program Starting*/ kernelStart(); /*Core function definitations*/ function kernelStart():Void { /*debug console*/ if(_root.DEBUG) createDebugMc(); var transXml:XML=new XML(); transXml.load(_root.gFileAddress); transXml.ignoreWhite=true; System.useCodepage = true; transXml.onLoad=function(success):Void { if(success) { mainF(transXml); } else { trace3(String("load news.xml error\n"+"this.status:"+String(this.status)+"\n")); } } } function mainF(inTransXml:XML) { var i:Number=0; var j:Number=0; var queueA:eQueue=new eQueue(1); var queueB:eQueue=new eQueue(1); queueA.deQueue(); queueB.deQueue(); var sign:Number=0; var tmpData:String=new String(); var drawCmdStr:String=new String(); var pationCirN:Number=12; _root.gIteratorLimit=parseInt(inTransXml.firstChild.attributes.iterLimit); _root.gInitString=inTransXml.firstChild.attributes.initString; _root.gFps=parseInt(inTransXml.firstChild.attributes.fps); _root.gStepLength=parseInt(inTransXml.firstChild.attributes.stepLen); pationCirN=parseInt(inTransXml.firstChild.attributes.pationCirN); _root.ClkWiseArc=Math.PI/pationCirN; _root.UnClkWiseArc=-Math.PI/pationCirN; //data init for(i=0;i<_root.gInitString.length;i++) queueA.enQueue(String(_root.gInitString.charAt(i))); i=0; sign=_root.SIGN_A; //Produce The Drawing String. while(i<_root.gIteratorLimit) { if(sign==_root.SIGN_A) { //queueA to queueB while(!queueA.isEmpty()) { tmpData=String(queueA.deQueue()); if(tmpData=="F"||tmpData=="f"||tmpData=="G"||tmpData=="g") for(j=0;j<_root.gInitString.length;j++) { queueB.enQueue(_root.gInitString.charAt(j)); } else if(tmpData=="+"||tmpData=="-"||tmpData=="|") queueB.enQueue(tmpData); } sign=_root.SIGN_B; } else if(sign==_root.SIGN_B) { //queueB to queueA while(!queueB.isEmpty()) { tmpData=String(queueB.deQueue()); if(tmpData=="F"||tmpData=="f"||tmpData=="G"||tmpData=="g") for(j=0;j<_root.gInitString.length;j++) queueA.enQueue(_root.gInitString.charAt(j)); else if(tmpData=="+"||tmpData=="-"||tmpData=="|") queueA.enQueue(tmpData); } sign=_root.SIGN_A; } i++; } //copy to drawCmdStr. drawCmdStr=""; if (sign==_root.SIGN_A) while(!queueA.isEmpty()) drawCmdStr+=String(queueA.deQueue()); else while(!queueB.isEmpty()) drawCmdStr+=String(queueB.deQueue()); //trace(drawCmdStr); //The Core Draw Sub. var myVector:E2DVector=new E2DVector(0,0);//the move cursor _root.gIteratorTimes=0; _root.gCmdLen=0; _root.gCurArc=0; trace(drawCmdStr); _root.gIntervalID=setInterval(KochCurve,_root.gFps,myVector,drawCmdStr); }