hmm, i dont know how understand my result1, result2 and result3:) zip file with source, maybe its help to understand what im need. http://flashgametemplate.com/test/ i can send a lot of code, maybe it help. So i try to make something like 'multiplication table'. var math1:Array = ["1x0=", "1x1=", "1x2=", "1x3=", "1x4=", "1x5=", "1x6=", "1x7=", "1x8=", "1x9="]; var math2:Array = ["2x0=", "2x1=", "2x2=", "2x3=", "2x4=", "2x5=", "2x6=", "2x7=", "2x8=", "2x9="]; var math3:Array = ["3x0=", "3x1=", "3x2=", "3x3=", "3x4=", "3x5=", "3x6=", "3x7=", "3x8=", "3x9="]; var math4:Array = ["4x0=", "4x1=", "4x2=", "4x3=", "4x4=", "4x5=", "4x6=", "4x7=", "4x8=", "4x9="]; var math5:Array = ["5x0=", "5x1=", "5x2=", "5x3=", "5x4=", "5x5=", "5x6=", "5x7=", "5x8=", "5x9="]; var math6:Array = ["6x0=", "6x1=", "6x2=", "6x3=", "6x4=", "6x5=", "6x6=", "6x7=", "6x8=", "6x9="]; var math7:Array = ["7x0=", "7x1=", "7x2=", "7x3=", "7x4=", "7x5=", "7x6=", "7x7=", "7x8=", "7x9="]; var math8:Array = ["8x0=", "8x1=", "8x2=", "8x3=", "8x4=", "8x5=", "8x6=", "8x7=", "8x8=", "8x9="]; var math9:Array = ["9x0=", "9x1=", "9x2=", "9x3=", "9x4=", "9x5=", "9x6=", "9x7=", "9x8=", "9x9="]; first of all user must answer to first array, then he go to second... but not sure then my code is right way to do my task:) a lot the same code.. all looks strange.. but i just try understand how all work.. all code: package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.utils.getDefinitionByName; import flash.utils.*; public class Mt extends MovieClip { var randomNumber:Number; var multiplied:Number; var ceiling:Number; var mTimes:Number = 0; var math1:Array = ["1x0=", "1x1=", "1x2=", "1x3=", "1x4=", "1x5=", "1x6=", "1x7=", "1x8=", "1x9="]; var math2:Array = ["2x0=", "2x1=", "2x2=", "2x3=", "2x4=", "2x5=", "2x6=", "2x7=", "2x8=", "2x9="]; var math3:Array = ["3x0=", "3x1=", "3x2=", "3x3=", "3x4=", "3x5=", "3x6=", "3x7=", "3x8=", "3x9="]; var math4:Array = ["4x0=", "4x1=", "4x2=", "4x3=", "4x4=", "4x5=", "4x6=", "4x7=", "4x8=", "4x9="]; var math5:Array = ["5x0=", "5x1=", "5x2=", "5x3=", "5x4=", "5x5=", "5x6=", "5x7=", "5x8=", "5x9="]; var math6:Array = ["6x0=", "6x1=", "6x2=", "6x3=", "6x4=", "6x5=", "6x6=", "6x7=", "6x8=", "6x9="]; var math7:Array = ["7x0=", "7x1=", "7x2=", "7x3=", "7x4=", "7x5=", "7x6=", "7x7=", "7x8=", "7x9="]; var math8:Array = ["8x0=", "8x1=", "8x2=", "8x3=", "8x4=", "8x5=", "8x6=", "8x7=", "8x8=", "8x9="]; var math9:Array = ["9x0=", "9x1=", "9x2=", "9x3=", "9x4=", "9x5=", "9x6=", "9x7=", "9x8=", "9x9="]; //constor public function Mt () { myRandom(); } public function myRandom():void { msg_txt.text = ""; answer_txt.text = ""; myRandomNumber(); nextMathBtn.visible = true; nextMathBtn.alpha = 0.5; nextMathBtn.enabled = false; checkBtn.visible = true; checkBtn.alpha = 1; checkBtn.enabled = true; gotoAndStop('m1'); trace("question: " + math1[ceiling]); question_txt.text = math1[ceiling]; checkBtn.addEventListener(MouseEvent.CLICK, chekingAnswer); } public function myRandom2():void { msg_txt.text = ""; answer_txt.text = ""; myRandomNumber(); nextMathBtn.visible = true; nextMathBtn.alpha = 0.5; nextMathBtn.enabled = false; checkBtn.visible = true; checkBtn.alpha = 1; checkBtn.enabled = true; gotoAndStop('m2'); trace("question: " + math2[ceiling]); question_txt.text = math2[ceiling]; checkBtn.addEventListener(MouseEvent.CLICK, chekingAnswer2); } public function myRandomNumber():void { randomNumber=Math.random(); multiplied = randomNumber*10-1; ceiling = Math.ceil(multiplied); } public function myDelay():void { setTimeout(myRandom, 1000); } public function myDelay2():void { setTimeout(myRandom2, 1000); } public function correctAnswer():void { trace("player entered: " + Number(answer_txt.text) + " << is CORRECT answer"); msg_txt.text = "correct"; //resultText_txt.text = math1[ceiling]; //resultText_txt.text = ""; resultText_txt.appendText(math1[ceiling]); //resultText_txt.appendText(math1[ceiling]); //resultText_txt.appendText(result3); mTimes = mTimes + 1; if (mTimes == 10) { trace("!!!!!!!!!!!!! 2 is finished !!!!!!!!!!!!"); myRandom2(); } nextMathBtn.alpha = 1; nextMathBtn.enabled = true; checkBtn.alpha = 0.5; checkBtn.enabled = false; if (mTimes == 10) { myDelay2(); } else { myDelay(); } } public function correctAnswer2():void { trace("player entered: " + Number(answer_txt.text) + " << is CORRECT answer"); msg_txt.text = "correct"; resultText_txt.text = math2[ceiling]; mTimes = mTimes + 1; if (mTimes == 10) { trace("3"); } nextMathBtn.alpha = 1; nextMathBtn.enabled = true; checkBtn.alpha = 0.5; checkBtn.enabled = false; myDelay2(); } public function chekingAnswer(event:MouseEvent):void { if (answer_txt.text == "") { msg_txt.text = "need enter result;)"; trace("player entered: NOTHING"); return; } if (Number(answer_txt.text) == 0 && ceiling == 0) { correctAnswer(); } else if (Number(answer_txt.text) == 1 && ceiling == 1) { correctAnswer(); } else if (Number(answer_txt.text) == 2 && ceiling == 2) { correctAnswer(); } else if (Number(answer_txt.text) == 3 && ceiling == 3) { correctAnswer(); } else if (Number(answer_txt.text) == 4 && ceiling == 4) { correctAnswer(); } else if (Number(answer_txt.text) == 5 && ceiling == 5) { correctAnswer(); } else if (Number(answer_txt.text) == 6 && ceiling == 6) { correctAnswer(); } else if (Number(answer_txt.text) == 7 && ceiling == 7) { correctAnswer(); } else if (Number(answer_txt.text) == 8 && ceiling == 8) { correctAnswer(); } else if (Number(answer_txt.text) == 9 && ceiling == 9) { correctAnswer(); } else { trace("player entered: " + Number(answer_txt.text) + " <<< is WRONG answer"); msg_txt.text = "wrong"; } } public function chekingAnswer2(event:MouseEvent):void { if (answer_txt.text == "") { msg_txt.text = "need enter result;)"; trace("player entered: NOTHING"); return; } if (Number(answer_txt.text) == 0 && ceiling == 0) { correctAnswer2(); } else if (Number(answer_txt.text) == 1 && ceiling == 2) { correctAnswer2(); } else if (Number(answer_txt.text) == 2 && ceiling == 4) { correctAnswer2(); } else if (Number(answer_txt.text) == 3 && ceiling == 6) { correctAnswer2(); } else if (Number(answer_txt.text) == 4 && ceiling == 8) { correctAnswer2(); } else if (Number(answer_txt.text) == 5 && ceiling == 10) { correctAnswer2(); } else if (Number(answer_txt.text) == 6 && ceiling == 12) { correctAnswer2(); } else if (Number(answer_txt.text) == 7 && ceiling == 14) { correctAnswer2(); } else if (Number(answer_txt.text) == 8 && ceiling == 16) { correctAnswer2(); } else if (Number(answer_txt.text) == 9 && ceiling == 18) { correctAnswer2(); } else { trace("player entered: " + Number(answer_txt.text) + " <<< is WRONG answer"); msg_txt.text = "wrong"; } } } }
... View more