Berikut codingnya :
var
g:int=1+Math.floor(10*Math.random())
var
o:int=1+Math.floor(10*Math.random())
if( g < o )
{ var tmp:int = g;
g = o;
o = tmp;}
angka3.text=String(g);
angka4.text=String(o);
periksa8.addEventListener(MouseEvent.CLICK,ceksoalm)
function
ceksoalm(event:MouseEvent):void
{ var t:int=Number(jawaban8.text)
if (g-o ==t){hasil8.text="Benar";}
else{hasil8.text="salah";}
}
ulang8.addEventListener(MouseEvent.CLICK,buatsoalm)
function
buatsoalm(event:MouseEvent):void
{ g=1+Math.floor(10*Math.random())
o=1+Math.floor(10*Math.random())
if( g < o )
{ var tmp:int = g;
g = o;
o = tmp;}
angka3.text=String(g);
angka4.text=String(o);
jawaban8.text="";
hasil8.text="";
}
Semoga bermanfaat, selamat bekarya :)
No comments:
Post a Comment