利用Flash制作的分数统计程序


利用Flash制作的分数统计程序



期未考试要改200多份试卷,算分算得昏昏然,就用flash做了个加分统计的Flash小程序,这是自己第一次使用组件,不过组件没有起到什么作用,使用输入文本也行。

版本flash CS3 正常使用需要Flash9以上的播放器。


代码如下:

//设置焦点,并添加键盘侦听
import flash.ui.Keyboard;
stage.focus =stage;
stage.addEventListener(KeyboardEvent.KEY_DOWN,sumSocre);

function sumSocre(event:KeyboardEvent):void {
score6_txt.text = "";
if(event.keyCode==Keyboard.ENTER)
{
var a:Number ;
//计算结果
a=Number(score1_txt.text)+Number(score2_txt.text)+Number(score3_txt.text)
+Number(score4_txt.text)+Number(score5_txt.text);
score6_txt.text=String(a);
//清空输入值
score1_txt.text = "";
score2_txt.text = "";
score3_txt.text = "";
score4_txt.text = "";
score5_txt.text = "";


}

}

源文件下载:http://www.etthink.com/thread-5524-1-1.html
原文地址:https://www.cnblogs.com/zhiji6/p/1649277.html