多个选择题
package com{ import flash.display.MovieClip; import flash.text.TextField; import flash.events.MouseEvent; import flash.system.fscommand; public class XSTwoTest1 extends MovieClip { public static var thisMc:MovieClip; public static var txtMc:MovieClip; public static var btnMc:MovieClip; public static var answerArr:Array; public static var coreNum:Number; public static var stepNum:Number; public static var arr:Array=["A","B","C","D"]; public function XSTwoTest1(_thisMc:MovieClip,_txtMc:MovieClip,_btnMc:MovieClip) { thisMc=_thisMc; txtMc=_txtMc; btnMc=_btnMc; answerArr=[]; stepNum=0; coreNum=0; for (var i:uint=0; i<txtMc.numChildren; i++) { var txt:TextField=txtMc.getChildAt(i) as TextField; answerArr.push(txt.text); txt.text=""; } btnMc.addEventListener(MouseEvent.CLICK,onBtn); txtMc.addEventListener(MouseEvent.CLICK,onTxt); } private function onBtn(e:MouseEvent) { var eTartP:MovieClip=e.target.parent as MovieClip; var num:Number; var str:String=e.target.name; for (var i:uint=0; i<btnMc.numChildren; i++) { if (eTartP.name==btnMc.getChildAt(i).name) { num=i; } } var txt:TextField=txtMc.getChildAt(num) as TextField; for (var j:uint=0; j<eTartP.numChildren; j++) { if (e.target.name==eTartP.getChildAt(j).name) { txt.text=arr[j]; } } } private function onTxt(e:MouseEvent) { var txt:TextField=e.target as TextField; txt.text=""; } public static function answerFun() { for (var i:uint=0; i<txtMc.numChildren; i++) { var txt:TextField=txtMc.getChildAt(i) as TextField; if (txt.text==answerArr[i]) { stepNum++; } } coreNum+=(3*stepNum); trace(coreNum+"coreNum1") } } }
posted on 2019-09-24 09:43 zqiang0803 阅读(103) 评论(0) 编辑 收藏 举报