清尘计算器

个人日记

计算器语句
1、C键上语句:
on (press, keyPress "c") {
 display = "0";
 operator = "";
 symbol = "";
 operand = false;
 clear = true;
 decimal = false;
}
on (press, keyPress "C") {
 display = "0";
 operator = "";
 symbol = "";
 operand = false;
 clear = true;
 decimal = false;
}

2、MR上:
on (release) {
 display = memory;
}
3、MC上:
on (release) {
 memory = 0;
 mem = " ";
 display = "0";
 operator = "";
 operand = false;
 clear = false;
 decimal = false;
}
4、M+上:
on (release) {
 memory = memory+Number(display);
 symbol = "";
 mem = "M+";
}
5、%上:
on (release, keyPress "%") {
 display = display*operand/100;
}
6、按键1上:
on (release, keyPress "1") {
 getdigit("1");
}
7、按键2上:
on (release, keyPress "2") {
 getdigit("2");
}

.....3、4、5、6、7、8、9、0、数字键上分别把语句中的数字改为相应的数字

8、小数点上:
on (release, keyPress ".") {
 if (!decimal) {
  getdigit(".");
  decimal = true;
 }
}
9、等号上:
on (release, keyPress "=") {
 getoperator();
}
10、加号上:
on (release, keyPress "+") {
 getoperator("+");
}
11、减号上:
on (release, keyPress "-") {
 getoperator("-");
}
12、*号上:
on (release, keyPress "*") {
 getoperator("*");
}
13、/号上:
on (release, keyPress "/") {
 getoperator("/");
}

14、得数文本变量名:display

15、AS层一帧语句
fscommand("showmenu", false);
fscommand("allowscale", false);
fscommand("fullscreen", false);
display = "0";
stop();
function getdigit(digit) {
 if (clear) {
  clear = false;
  decimal = false;
  display = "0";
 }
 if (length(display)<13) {
  if (display == "0" and digit != ".") {
   display = digit;
  } else {
   display = display+digit;
  }
 }
}
function getoperator(sign) {
 if (operator == "+") {
  display = Number(operand)+Number(display);
  symbol = operator;
 }
 if (operator == "*") {
  symbol = "x";
  display = operand*display;
 }
 if (operator == "-") {
  symbol = operator;
  display = operand-display;
 }
 if (operator == "/") {
  symbol = operator;
  display = operand/display;
 }
 operator = "=";
 clear = true;
 symbol = " ";
 decimal = "false";
 if (sign != null) {
  operator = sign;
  if (operator == "*") {
   symbol = "x";
  } else {
   symbol = operator;
  }
  operand = display;
 }
}
fscommand("showmenu", false);
fscommand("allowscale", false);
fscommand("fullscreen", false);
display = "0";
stop();
function getdigit(digit) {
 if (clear) {
  clear = false;
  decimal = false;
  display = "0";
 }
 if (length(display)<13) {
  if (display == "0" and digit != ".") {
   display = digit;
  } else {
   display = display+digit;
  }
 }
}
function getoperator(sign) {
 if (operator == "+") {
  display = Number(operand)+Number(display);
  symbol = operator;
 }
 if (operator == "*") {
  symbol = "x";
  display = operand*display;
 }
 if (operator == "-") {
  symbol = operator;
  display = operand-display;
 }
 if (operator == "/") {
  symbol = operator;
  display = operand/display;
 }
 operator = "=";
 clear = true;
 symbol = " ";
 decimal = "false";
 if (sign != null) {
  operator = sign;
  if (operator == "*") {
   symbol = "x";
  } else {
   symbol = operator;
  }
  operand = display;
 }
}
fscommand("showmenu", false);
fscommand("allowscale", false);
fscommand("fullscreen", false);
display = "0";
stop();
function getdigit(digit) {
 if (clear) {
  clear = false;
  decimal = false;
  display = "0";
 }
 if (length(display)<13) {
  if (display == "0" and digit != ".") {
   display = digit;
  } else {
   display = display+digit;
  }
 }
}
function getoperator(sign) {
 if (operator == "+") {
  display = Number(operand)+Number(display);
  symbol = operator;
 }
 if (operator == "*") {
  symbol = "x";
  display = operand*display;
 }
 if (operator == "-") {
  symbol = operator;
  display = operand-display;
 }
 if (operator == "/") {
  symbol = operator;
  display = operand/display;
 }
 operator = "=";
 clear = true;
 symbol = " ";
 decimal = "false";
 if (sign != null) {
  operator = sign;
  if (operator == "*") {
   symbol = "x";
  } else {
   symbol = operator;
  }
  operand = display;
 }
}

16、时间文本变量名:时间    日期文本变量名:日期     星期文本变量名:星期
17、文本AS:
function ClockFun() {
 time = new Date();
 hour = time.getHours()*30;
 minute = time.getMinutes()*6;
 second = time.getSeconds()*6;
 minute += time.getSeconds()/10;
 hour += time.getMinutes()/2;
 秒针._rotation = second;
 分针._rotation = minute;
 时针._rotation = hour;
 months = time.getMonth();
 months = time.getMonth()+1;
 if (length(months) == 1) {
  months = "0"+months;
 }
 dates = time.getDate();
 if (length(dates) == 1) {
  dates = "0"+dates;
 }
 日期 = time.getFullYear()+"年"+months+"月"+dates+"日";
 dates = time.getDate();
 if (length(dates) == 1) {
  dates = "0"+dates;
 }
 日期 = time.getFullYear()+"年"+months+"月"+dates+"日";
 days = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
 day = time.getDay();
 星期 = days[day];
 hours = time.getHours();
 minutes = time.getMinutes();
 seconds = time.getSeconds();
 hours = (time.getHours() == 0) ? "0"+hours : time.getHours();
 minutes = (length(minutes) == 1) ? "0"+time.getMinutes() : time.getMinutes();
 seconds = (length(seconds) == 1) ? "0"+seconds : time.getSeconds();
 时间 = hours+":"+minutes+":"+seconds;
}
setInterval(ClockFun, 1000);

文章评论

清尘一笑

挺实用的家庭计算器.是家庭主妇理财的好帮手.

蝶舞红尘

都是乱码 不会用 [em]e149[/em] 群主留着用吧[em]e120[/em]

未来的梦

清尘老师,拿走了,辛苦老师了。[em]e182[/em]

清@画

[em]e182[/em] [em]e160[/em] [em]e177[/em] [em]e183[/em]

云/ka淡然

奇怪 她们咋总是发现的那么早 [em]e114[/em]

水 榭 听 香

啥也看不见,还家庭主妇实用的计算器呢,我不是家庭主妇看不见吧[em]e120[/em]

冰心飘雪

师父 辛苦了 师父真厉害 下面的代码没看懂 但计算机很实用 加减法都管用[em]e120[/em] 拿回家琢磨

愫心如玉

师父真棒,辛苦啦[em]e156[/em] 很实用的,分享了[em]e183[/em]