选字前面选,后面答案
package com{ import flash.display.MovieClip; import flash.display.SimpleButton; import flash.events.MouseEvent; import flash.text.TextField; public class SecondFrame extends MovieClip { private var thisMc:MovieClip; private var btnMc:MovieClip; public static var answerArr:Array = []; private var arr:Array = ["A","B","C","D"]; private var nextBtn:SimpleButton; public function SecondFrame(_thisMc:MovieClip,_btnMc:MovieClip) { thisMc = _thisMc; btnMc = _btnMc; btnMc.addEventListener(MouseEvent.CLICK,btnMcFun); for (var i:uint =0; i<btnMc.numChildren; i++) { btnMc.getChildAt(i).alpha = 0; } } private function btnMcFun(e:MouseEvent) { if (e.target.alpha == 0) { e.target.alpha = 1; } else { e.target.alpha = 0; } } public function nextFun(_nextBtn:SimpleButton ) { nextBtn = _nextBtn; nextBtn.addEventListener(MouseEvent.CLICK,onNextBtn); } private function onNextBtn(e:MouseEvent) { for (var i:uint =0; i<btnMc.numChildren; i++) { if (btnMc.getChildAt(i).alpha == 1) { answerArr.push(i); } } if (answerArr.length != 0) { thisMc.nextFrame(); btnMc.removeEventListener(MouseEvent.CLICK,btnMcFun); nextBtn.removeEventListener(MouseEvent.CLICK,onNextBtn); } else { answerArr = []; } } } }
//答案////////////// private var arr2:Array = [10,15]; public function Answer2(_mc:MovieClip ) { _mc["circle"].alpha = 0; if (SecondFrame.answerArr.length != arr2.length) { _mc["circle"].alpha = 1; _mc["right"].nextFrame(); for (var i:uint=0; i<SecondFrame.answerArr.length; i++) { _mc["answerMc"].getChildAt(SecondFrame.answerArr[i]).alpha = 1; } } else { for (var j:uint=0; j<arr2.length; j++) { if (SecondFrame.answerArr[j] == arr2[j]) { if(j==arr2.length -1){ funnum1()} } else { _mc["circle"].alpha = 1; _mc["right"].nextFrame(); } } } }
posted on 2019-05-04 14:52 zqiang0803 阅读(122) 评论(0) 编辑 收藏 举报