// Calculator design and powered by tangyan
fscommand("showmenu", false);
//关闭右键菜单
fscommand("allowscale", false);
//播放不进行缩放
fscommand("fullscreen", false);
//不全屏幕显示。前面的几行是对播放器的设置,可以不管他,
//如果有兴趣的话,可以参考金鹰FLASH AS教程
// ***Initializing the variables
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);
//不全屏幕显示
// ***Initializing the variables
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;
}
}
// Calculator design and made by jinjun
fscommand("showmenu", false);
//关闭右键菜单
fscommand("allowscale", false);
//播放不进行缩放
fscommand("fullscreen", false);
//不全屏幕显示
// ***Initializing the variables
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;
}
}
//到此为止是第一帧的脚本代码
//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;
}
//MR
on (release) {
display = memory;
// memory = 0;
// symbol = " ";
// clear = true;
}
//MC
on (release) {
memory = 0;
mem = " ";
display = "0";
operator = "";
operand = false;
clear = false;
decimal = false;
}
//M+
on (release) {
memory = memory+Number(display);
symbol = "";
mem = "M+";
}
//%
on (release, keyPress "%") {
display = display*operand/100;
}
//1
on (release, keyPress "1") {
getdigit("1");
}
//on (release, keyPress "2") {
getdigit("2");
}
//3 4 5 6 7 8 9 0和上面的1 2 相同
//+
on (release, keyPress "+") {
getoperator("+");
}
//-
on (release, keyPress "-") {
getoperator("-");
}
//*
on (release, keyPress "*") {
getoperator("*");
}
//除号“/”
on (release, keyPress "/") {
getoperator("/");
}
//=
on (release, keyPress "=") {
getoperator();
}
//小数点 “.”
on (release, keyPress ".") {
if (!decimal) {
getdigit(".");
decimal = true;
}
}
//下面是时间的显示
function bb() {
var rq:Date = new Date();
nian = rq.getFullYear();
yue = rq.getMonth()+1;
ri = rq.getDate();
if (rq.getHours()<10) {
shi = "0"+rq.getHours();
} else {
shi = rq.getHours();
}
if (rq.getMinutes()<10) {
fen = "0"+rq.getMinutes();
} else {
fen = rq.getMinutes();
}
if (rq.getSeconds()<10) {
miao = "0"+rq.getSeconds();
} else {
miao = rq.getSeconds();
}
xingqi = rq.getDay();
var xq:Array = new Array("星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
t1 = nian+"年"+yue+"月"+ri+"日"+xq[xingqi];
t2 = shi+":"+fen+":"+miao;
}
call(bb());
intervalId = setInterval(this, "bb", 300);
温馨提示:内容为网友见解,仅供参考
怎么用Flash脚本做简易计算器。a+b=c。
\/\/关闭右键菜单 fscommand("allowscale", false);\/\/播放不进行缩放 fscommand("fullscreen", false);\/\/不全屏幕显示。前面的几行是对播放器的设置,可以不管他,\/\/如果有兴趣的话,可以参考金鹰FLASH AS教程 \/\/ ***Initializing the variables display = "0";\/\/显示输入和计算结果的变量 stop();...
想在flash作品(swf文件)里加一个计算器,程序怎么写
你可以去买《FLASHMX从入门到精通》里面有讲解。具体我也不大会。大概就是做两个文本框,属性要设置成输入文本。一个属性的变量改成a一个改成b。要设置成显示边框。(就是变量左边的那个按钮,鼠标放在上边出现“在文本周围显示边框”)做一个文本,属性改成动态文本,变量写成c。也显示边框。在做一...
[FLASH-AC]二次函数计算器
[FLASH-AC]二次函数计算器 20 我做了一个二次函数计算器舞台中有6个变量x1x2x3y1y2y3都是输入文本还有三变量是动态文本为a,b,c以下是关联在按钮上的脚本on(release){a=((y2-y3)*(x1-x3)-(x2-x3)*(y1-y3))\/((x1-x... 我做了一个二次函数计算器舞台中有6个变量x1x2x3y1y2y3都是输入文...
flash制作简易计算器
在场景中选择加号按钮 打开属性 看看他的名称是否是 b1 你还可以在每个按钮按下后输出特定的值 比如trace(1)
求助用flash做计算器功能
先新建一个flash文档,添加两个输入文本框,一个变量是x,一个变量是y。新建两个按钮,一个是计算,一个是清除。再弄一个动态文本框,变量是z。在两个输入框之间添加一个静态文本,输入一个“+”。把两个按钮放入舞台,在“计算”按钮上输入命令 on (release) {n=number(x)+number(y),z=n} ...
flash制作计算器问题
因为a,b都是文本框的内容,而文本框的内容是什么呢,当然是字符串了.所以,你要写:c = Number(a)+Number(b);c = Number(a)*Number(b);...把他们转换成数字
flash 简单计算器
试试 on (press) { b.text = Number (a.text)\/(Number(c.text)\/31.10348);}
flash计算器
1。新建一个Flash文档 2。添加一个输入文本,在“属性”面板中,设置变量名为i1,字符为“数字”;添加一个输入文本,在“属性”面板中,设置变量名为i2,字符为“数字”;添加一个动态文本,变量为output;添加一个按钮用于计算;添加一个按钮用于清空。3。选中计算按钮,打开“动作”面板,输入以下...
求flash高手解答我用flash 做加法计算器输入文本可以输入文字 但按下...
建立两个输入文本,变量名分别为a和b,用来输入数字;建立一个动态文本,变量名为c,用来显示运算结果;再建立两上静态文本,分别输入“+”和“=”,排列好五个文本的位置,制作一个“计算”按钮放在下方;选中“计算”按钮,输入以下代码:on (release) { var c=Number(a)+Number(b)} ...
哪位高手给我一个flash加法计算器的代码?
on(release){ int a=int.Parse(a.Text)+int.Parse(b.Text);c.Text=a.ToString();}