注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

有我不怕80-90后博_95后00后博客

http://jiangfusheng.blog.163.com/精彩不断

 
 
 

日志

 
 

Flash制作计算器AS  

2015-03-12 23:22:48|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |



// 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);

  评论这张
 
阅读(3)| 评论(0)
推荐

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017