berikut action script yang digunakan dalam video :
benar_mc.visible=false;
salah_mc.visible=false;
var orig1X:Number=item1_mc.x;
var orig1Y:Number=item1_mc.y;
var orig2X:Number=item2_mc.x;
var orig2Y:Number=item2_mc.y;
var orig3X:Number=item3_mc.x;
var orig3Y:Number=item3_mc.y;
item1_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragTheObject);
item1_mc.addEventListener(MouseEvent.MOUSE_UP,item1Release);
item2_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragTheObject);
item2_mc.addEventListener(MouseEvent.MOUSE_UP,item2Release);
item3_mc.addEventListener(MouseEvent.MOUSE_DOWN,dragTheObject);
item3_mc.addEventListener(MouseEvent.MOUSE_UP,item3Release);
cek_btn.addEventListener(MouseEvent.CLICK,checkAnswers);
reset_btn.addEventListener(MouseEvent.CLICK,reset);
function dragTheObject(event:MouseEvent):void{
var item=MovieClip(event.target);
item.startDrag();
var topPos:uint=this.numChildren-1;
}
function item1Release(event:MouseEvent):void{
var item:MovieClip=MovieClip(event.target);
item.stopDrag();
if (dropZone1_mc.hitTestObject(item)){
item.x=dropZone1_mc.x+20;
item.y=dropZone1_mc.y+27;
}
else{
item.x=orig1X;
item.y=orig1Y;
}
}
function item2Release(event:MouseEvent):void{
var item:MovieClip=MovieClip(event.target);
item.stopDrag();
if (dropZone2_mc.hitTestObject(item)){
item.x=dropZone2_mc.x+20;
item.y=dropZone2_mc.y+20;
}
else{
item.x=orig2X;
item.y=orig2Y;
}
}
function item3Release(event:MouseEvent):void{
var item:MovieClip=MovieClip(event.target);
item.stopDrag();
if (dropZone3_mc.hitTestObject(item)){
item.x=dropZone3_mc.x+20;
item.y=dropZone3_mc.y+19;
}
else{
item.x=orig3X;
item.y=orig3Y;
}
}
function checkAnswers(event:MouseEvent):void{
if(dropZone1_mc.hitTestObject(item1_mc)&&
dropZone2_mc.hitTestObject(item2_mc)&&
dropZone3_mc.hitTestObject(item3_mc)){
salah_mc.visible=false;
benar_mc.visible=true;
}
else {
salah_mc.visible=true;
benar_mc.visible=false;
}}
function reset(event:MouseEvent):void{
item1_mc.x=orig1X;
item1_mc.y=orig1Y;
item2_mc.x=orig2X;
item2_mc.y=orig2Y;
item3_mc.x=orig3X;
item3_mc.y=orig3Y;
benar_mc.visible=false;
salah_mc.visible=false;
}
terimakasih sudah menonton video ini.