import flash.events.MouseEvent;
var zhiQianshu:String;
var jiaboo:Boolean=false;
var jianboo:Boolean=false;
var chengboo:Boolean=false;
var chuboo:Boolean=false;
mc1_btn.addEventListener(MouseEvent.CLICK,onMc1_btnClickHandler);
function onMc1_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("1");
}
mc2_btn.addEventListener(MouseEvent.CLICK,onMc2_btnClickHandler);
function onMc2_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("2");
}
mc3_btn.addEventListener(MouseEvent.CLICK,onMc3_btnClickHandler);
function onMc3_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("3");
}
mc4_btn.addEventListener(MouseEvent.CLICK,onMc4_btnClickHandler);
function onMc4_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("4");
}
mc5_btn.addEventListener(MouseEvent.CLICK,onMc5_btnClickHandler);
function onMc5_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("5");
}
mc6_btn.addEventListener(MouseEvent.CLICK,onMc6_btnClickHandler);
function onMc6_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("6");
}
mc7_btn.addEventListener(MouseEvent.CLICK,onMc7_btnClickHandler);
function onMc7_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("7");
}
mc8_btn.addEventListener(MouseEvent.CLICK,onMc8_btnClickHandler);
function onMc8_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("8");
}
mc9_btn.addEventListener(MouseEvent.CLICK,onMc9_btnClickHandler);
function onMc9_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("9");
}
mc0_btn.addEventListener(MouseEvent.CLICK,onMc0_btnClickHandler);
function onMc0_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText("0");
}
Dian_btn.addEventListener(MouseEvent.CLICK,onDian_btnClickHandler);
function onDian_btnClickHandler(e:MouseEvent)
{
if(qingkongboo==true)//按过等于之后再次计算,按任意键赋值,并把之前的数清空;
{
input_txt.text="";
qingkongboo=false;
}
input_txt.appendText(".");
}
inset_btn.addEventListener(MouseEvent.CLICK,onInset_btnClickHandler);
function onInset_btnClickHandler(e:MouseEvent)
{
input_txt.text="";
}
Jia_btn.addEventListener(MouseEvent.CLICK,onJia_btnClickHandler);
function onJia_btnClickHandler(e:MouseEvent)
{
if(jiaboo==true)//实现连加
{
input_txt.text=String(Number(zhiQianshu)+Number(input_txt.text));
jiaboo=false;
}
zhiQianshu=input_txt.text;
//trace(zhiQianshu);
input_txt.text="";
jiaboo=true;
}
Jian_btn.addEventListener(MouseEvent.CLICK,onJian_btnClickHandler);
function onJian_btnClickHandler(e:MouseEvent)
{
if(jianboo==true)//实现连减
{
input_txt.text=String(Number(zhiQianshu)-Number(input_txt.text));
zhiQianshu=input_txt.text;
jianboo=false;
}
zhiQianshu=input_txt.text;
input_txt.text="";
jianboo=true;
}
Cheng_btn.addEventListener(MouseEvent.CLICK,onCheng_btnClickHandler);
function onCheng_btnClickHandler(e:MouseEvent)
{
if(chengboo==true)//实现连乘
{
input_txt.text=String(Number(zhiQianshu)*Number(input_txt.text));
chengboo=false;
}
zhiQianshu=input_txt.text;
input_txt.text="";
chengboo=true;
}
Chu_btn.addEventListener(MouseEvent.CLICK,onChu_btnClickHandler);
function onChu_btnClickHandler(e:MouseEvent)
{
if(chuboo==true)//实现连除
{
input_txt.text=String(Number(zhiQianshu)/Number(input_txt.text));
chuboo=false;
}
zhiQianshu=input_txt.text;
input_txt.text="";
chuboo=true;
}
var qingkongboo:Boolean=false;
Enter_btn.addEventListener(MouseEvent.CLICK,onEnter_btnClickHandler);
function onEnter_btnClickHandler(e:MouseEvent)
{
if(jiaboo==true)
{
input_txt.text=String(Number(zhiQianshu)+Number(input_txt.text));
jiaboo=false;
}
if(jianboo==true)
{
input_txt.text=String(Number(zhiQianshu)-Number(input_txt.text));
jianboo=false;
}
if(chengboo==true)
{
input_txt.text=String(Number(zhiQianshu)*Number(input_txt.text));
chengboo=false;
}
if(chuboo==true)
{
input_txt.text=String(Number(zhiQianshu)/Number(input_txt.text));
chuboo=false;
}
qingkongboo=true;
}