Flash AS 3.0 ile hazırlamış olduğum hesap makinesi aşağıda kodları bulunmaktadır ancak açıklama satırları koymadım anlamadığınız kısımlar da sorular sorabilirsiniz açıklamasını yapabilirim.
Kodlar
var sayibir:Number=0;
var sayiiki:Number=0;
var sondeger:Number=0;
var islem:Number=0;
var sayac:Number=1;
bir_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_18);
function fl_MouseClickHandler_18(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+1);
}
iki_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_19);
function fl_MouseClickHandler_19(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+2);
}
uc_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_20);
function fl_MouseClickHandler_20(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+3);
}
dort_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_21);
function fl_MouseClickHandler_21(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+4);
}
bes_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_22);
function fl_MouseClickHandler_22(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+5);
}
alti_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_23);
function fl_MouseClickHandler_23(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+6);
}
yedi_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_24);
function fl_MouseClickHandler_24(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+7);
}
sekiz_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_25);
function fl_MouseClickHandler_25(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+8);
}
dokuz_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_26);
function fl_MouseClickHandler_26(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+9);
}
sifir_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_27);
function fl_MouseClickHandler_27(event:MouseEvent):void
{
if(sondeger==Number(sonuc_txt.text)){
//sayibir=Number(sonuc_txt.text);
sonuc_txt.text="";
}
sonuc_txt.text=String(sonuc_txt.text+0);
}
arti_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_28);
function fl_MouseClickHandler_28(event:MouseEvent):void
{
islem=1;
if(sayac==1){
sondeger=Number(sonuc_txt.text);
sonuc_txt.text="";
}
if(sayac > =2){
sayiiki=Number(sonuc_txt.text);
sondeger=sondeger+sayiiki;
sonuc_txt.text=String(sondeger);
}
sayac=sayac+1;
}
esit_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_29);
function fl_MouseClickHandler_29(event:MouseEvent):void
{
sayiiki=Number(sonuc_txt.text);
if(islem==1){
sondeger=sayibir+sayiiki;
sonuc_txt.text=String(sondeger);
}
if(islem==2){
sondeger=sayibir-sayiiki;
sonuc_txt.text=String(sondeger);
}
if(islem==3){
sondeger=sayibir*sayiiki;
sonuc_txt.text=String(sondeger);
}
if(islem==4){
sondeger=sayibir/sayiiki;
sonuc_txt.text=String(sondeger);
}
}
eksi_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_30);
function fl_MouseClickHandler_30(event:MouseEvent):void
{
islem=2;
if(sayac==1){
sondeger=Number(sonuc_txt.text);
sonuc_txt.text="";
}
if(sayac > =2){
sayiiki=Number(sonuc_txt.text);
sondeger=sondeger-sayiiki;
sonuc_txt.text=String(sondeger);
}
sayac=sayac+1;
}
carpi_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_31);
function fl_MouseClickHandler_31(event:MouseEvent):void
{
islem=3;
if(sayac==1){
sondeger=Number(sonuc_txt.text);
sonuc_txt.text="";
}
if(sayac > =2){
sayiiki=Number(sonuc_txt.text);
sondeger=sondeger*sayiiki;
sonuc_txt.text=String(sondeger);
}
sayac=sayac+1;
}
bolu_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_32);
function fl_MouseClickHandler_32(event:MouseEvent):void
{
islem=4;
if(sayac==1){
sondeger=Number(sonuc_txt.text);
sonuc_txt.text="";
}
if(sayac > =2){
sayiiki=Number(sonuc_txt.text);
sondeger=sondeger/sayiiki;
sonuc_txt.text=String(sondeger);
}
sayac=sayac+1;
}
sil_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_33);
function fl_MouseClickHandler_33(event:MouseEvent):void
{
sonuc_txt.text="";
islem=0;
sayibir=0;
sayiiki=0;
sondeger=0;
}
sin_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_34);
function fl_MouseClickHandler_34(event:MouseEvent):void
{
sonuc_txt.text=String(Number(Math.sin(Number(sonuc_txt.text)*Math.PI/180)));
}
kare_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_35);
function fl_MouseClickHandler_35(event:MouseEvent):void
{
sonuc_txt.text=String(Number(Math.pow(Number(sonuc_txt.text),2)));
}
Kaynak: http://www.tekno-logy.com/flash-action-script-3-0-hesap-makinesi.html
.FLA Olarak indir : http://www.tekno-logy.com/wp-content/uploads/2012/11/hesaplamalar.zip