关于羡慕嫉妒恨的说说:求助AS牛人.帮忙解读段代码.写清楚明白.谢谢

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/27 16:31:03
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;
}
}
你好 ~由于代码比较混乱可不可以加QQ说呢??我会提高分数的,您有时间帮我解答下就好.初学有些地方还混乱

这是用flash做计算器时,对用户输入操作符号的判定,实现加减乘除运算,代码不全阿,没法分析。
if (clear) {
clear = false;
decimal = false;
display = "0";
....
这里肯定是按下清除按钮,将结果清0拉。很简单啊,不过你没有发完整代码。
QQ:4638470 没事,我也爱好flash,有时间聊聊。