Materi Perkuliahan

membuat pohon faktor mrnggunakan macromedia flash

Dipublikasikan pada : 29 Januari 2020.

function awal(){
a=nilai1._width+30;
b=nilai1._height+100;
a1=nilai2._width+250;
b1=nilai2._height+100;
f=nilai1.text;
f1=nilai2.text;
_root.createTextField(“gambar”,getNextHighestDepth(),a,b,40,20);
_root.createTextField(“gambar1″,getNextHighestDepth(),a1,b1,40,20);
gambar.text=nilai1.text;
gambar1.text=nilai2.text;
gambar.border=true;
gambar1.border=true;
kalimat=newTextFormat();
kalimat.size=18;
kalimat.color=0x009966;
kalimat.align=”center”;
kalimat.bold=true;
gambar.setTextFormat(kalimat);
gambar1.setTextFormat(kalimat);
kalimatc=newTextFormat();
kalimatc.size=18;
kalimatc.color=0xffff32;
kalimatc.align=”center”;
kalimatc.bold=true;
}
hit=0;
gambarb=newObject();
gambarb.onKeyDown=function(){
if(Key.isDown(Key.UP)){
awal();
hit+=1;
}
if(Key.isDown(Key.RIGHT)){
if(hit==1){
_root[“gambarbe”+String(c)].background=true;
_root[“gambarbe”+String(c)].backgroundColor=9699690/e;
_root[“gambarbe”+String(c)].setTextFormat(kalimatc);
hit+=1;
}else if (hit==2){
_root[“gambarbern”+String(c1)].background=true;
_root[“gambarbern”+String(c1)].backgroundColor=9699690/e1;
_root[“gambarbern”+String(c1)].setTextFormat(kalimatc);
hit=0;
}
}
};
c=0;
Key.addListener(gambarb);
_root.createEmptyMovieClip(“kalimatb”,getNextHighestDept());
_root.createEmptyMovieClip(“kalimatbear”,getNextHighestDepth());
c1=0;
hitung.onRelease=function(){
for(i=2;i<f;i++){
d=f%i;
e=f/i;
if(d==0){
c=c+1;
_root.createTextField(“gambarbe”+String(c),grtNextHighestDepth(),gambar._x+c*(gambar._width/2+5),gambar._y+c*30,40,20);
_root[“gambarbe”+String(c)].text=e;
_root[“gambarbe”+String(c)].border=true;
_root[“gambarbe”+String(c)].setTextFormat(kalimat);
g=root[“gambarbe”+String(c)]._x;
_root.createTextField(“gambarber”+String(c),getNextHighestDepth(),g-50,gambar._y+c*30,40,20);
_root[“gambarber”+String(c)].text=i;
_root[“gambarber”+String(c)].border=true;
_root[“gambarber”+String(c)].setTextFormat(kalimatc);
f=e;
_root[“gambarber”+String(c)].background=true;
_root[“gambarber”+String(c)].backgroundColor=9699690/i;
with(kalimatb){
linestyle(1,0×000000,100);
moveTo(gambar._x+c*(gambar._width/2+5),gambar._y+c*30-(gambar._height/2));
lineTo(gambar._x+(c+1)*(gambar._width/2+5),gambar._y+c*30-(3*gambar._height/2));
moveTo(gambar._x+c*(gambar._width/2+5),gambar._y+c*30-(gambar._height/2));
lineTo(g-50+gambar._width/2,gambar._y+(c+1)*30-(3*gambar._height/2));
}
break;
}
}
};
hitung1.onRelease=function(){
for(i1=2;i1<f1;i1++){
d1=f1%i1;
e1=f1/i1;
if(d1==0){
c1=c1+1;
_root.createTextField(“gambarbern”+String(c1),getNextHighestDepth(),gambar1._x+c1*(gambar1._width/2+5),gambar1._y+c1*30,40,20);
_root[“gambarbern”+String(c1)].text=e1;
_root[“gambarbern”+String(c1)].border=true;
_root[“gambarbern”+String(c1)].setTextFormat(kalimat);
g1=_root[“gambarbern”+String(c1)]._x;
_root.createTextField(“gambarberna”+String(c1),getNextHighestDepth(),g1-50,gambar1._y+c1*30,40,20);
_root[“gambarberna”+String(c1)].text=i1;
_root[“gambarberna”+String(c1)].border=true;
_root[“gambarberna”+String(c1)].setTextFormat(kalimatc);
f1=e1;
_root[“gambarberna”+String(c1)].background=true;
_root[“gambarberna”+String(c1)].backgroundColor=9699690/i1;
with(kalimatbear){
linestyle(1,0×000000,100);
moveTo(gambar1._x+c1*(gambar1._width/2+5),gambar1._y+c1*30-(gambar1._height/2));
lineTo(gambar1._x+(c1+1)*(gambar1._width/2+5),gambar1._y+(c1+1)*30-(3*gambar._height/2));
moveTo(gambar1._x+c1*(gambar1._width/2+5),gambar1._y+c1*30-(gambar1._height/2));
lineTo(g1-50+gambar1._width/2,gambar1._y+(c1+1)*30-(3*gambar1._height/2));
}
break;
}
}
};
hapus.onRelease=function(){
gambar.removeTextField();
gambar1.removeTextField();
for(j=0;j<=c;j++){
_root[“gambarbe”+String(j)].removeTextField();
_root[“gambarber”+String(j)].removeTextField();
}
for(j1=0;j1<=c1;j1++){
_root[“gambarbern”+String(j1)].removeTextField();
_root[“gambarberna”+String(j1)].removeTextField();
}
kalimatb.clear();
kalimatbear.clear();
c=0;
c1=0;
};

id_IDIndonesian