Saturday, 16 April 2016

ONE TEXT BOX CALCULATOR


----------------------------------------------------------------------------------------------------------------------
STEP NO:1
0) MAKE FIRST LAYER
1) MAKE TEXT BOX
2)  GIVE VARIABLE NAME : screen
---------------------------------------------------------------------------------------------------------------------
STEP NO:2
0) COPY AND PASTE IMAGES ON FIRST LAYER
--------------------------------------------------------------------------------------------------------------------
















--------------------------------------------------------------------------------------------------------------------
STEP NO:3
0) COPY AND PASTE INSERT BUTTON CODES
--------------------------------------------------------------------------------------------------------------------
//INSERT C BUTTON CODE
on(release){
screen="";
operation="no";
}
//INSERT 7 BUTTON CODE
on(release){
screen=screen+"7";
}
//INSERT 8 BUTTON CODE
on(release){
screen=screen+"8";
}
//INSERT 9 BUTTON CODE
on(release){
screen=screen+"9";
}
//INSERT 4 BUTTON CODE
on(release){
screen=screen+"4";
}
//INSERT 5 BUTTON CODE
on(release){
screen=screen+"5";
}
//INSERT 6 BUTTON CODE
on(release){
screen=screen+"6";
}
//INSERT 1 BUTTON CODE
on(release){
screen=screen+"1";
}
//INSERT 2 BUTTON CODE
on(release){
screen=screen+"2";
}
//INSERT 3 BUTTON CODE
on(release){
screen=screen+"3";
}
--------------------------------------------------------------------------------------------------------------------
SIGNS CODE:
--------------------------------------------------------------------------------------------------------------------

//INSER EQUAL BUTTON CODE
on(release){
if (operation=="tambah"){
myArray=screen.split("+");
number1=Number(myArray[0]);
number2=Number(myArray[1]);
total=number1+number2;
screen=total;
operation="no";
}
if (operation=="kurang"){
myArray=screen.split("-");
number1=Number(myArray[0]);
number2=Number(myArray[1]);
total=number1-number2;
screen=total;
operation="no";
}
if (operation=="kali"){
myArray=screen.split("*");
number1=Number(myArray[0]);
number2=Number(myArray[1]);
total=number1*number2;
screen=total;
operation="no";
}
if (operation=="bagi"){
myArray=screen.split("/");
number1=Number(myArray[0]);
number2=Number(myArray[1]);
total=number1/number2;
screen=total;
operation="no";
}
}

//INSERT PLUS BUTTON CODE
on(release){
if(operation=="no"){
screen=screen+"+";
operation="tambah";
}
}

//INSERT MINUS BUTTON CODE
on(release){
if(operation=="no"){
screen=screen+"-";
operation="kurang";
}
}

//INSERT MULTI BUTTON CODE
on(release){
if(operation=="no"){
screen=screen+"*";
operation="kali";
}
}

//INSERT DIVIDE BUTTON CODE
on(release){
if(operation=="no"){
screen=screen+"/";
operation="bagi";
}
}
--------------------------------------------------------------------------------------------------------------------
STEP NO:4
1) MAKE LAYER 2
1) LAYER 2 FRAME 2  CODES
--------------------------------------------------------------------------------------------------------------------
operation="no";
screen="";
stop();



EmoticonEmoticon