Copy link to clipboard
Copied
1084 SYNTAX ERROR:expecting rightbrace before end of program
Here is my Code:
//---- script drag ndrop puzzle ----
var obyeks:Array=new Array();
var boxs:Array=new Array();
obyeks=[puzzle1,puzzle2,puzzle3];
boxs=[kotak1,kotak2,kotak3];
for(var i:Number=0;i<obyeks.length;i++)
{
obyeks[i].addEventListener(MouseEvent.MOUSE_DOWN,startdrag);
obyeks[i].addEventListener(MouseEvent.MOUSE_UP,stopdrag);
}
function startdrag(e:MouseEvent) {
ecurrentTarget.startDrag();
}
function stopdrag(e:MouseEvent) {
ecurrentTarget.stopDrag();
for(var i:Number=0 ;i<obyeks.length;i++)
{
for(var j:Number=0;j<boxs.length;j++)
{
if ((Math.abs(obyeks[i].x - boxs[j].x) < 50) && (Math.abs(obyeks[i].y - boxs[j].y) <50))
obyeks[i].x=boxs[j].x;
obyeks[i].y=boxs[j].y;
}
}
}
function updateScore()
{
for (var i:Number=0;i<obyeks.length;i++)
{
if (((obyeks[0].x==boxs[0].x)&&(obyeks[0].y==boxs[0].y))
&&((obyeks[1].x==boxs[1].x)&&(obyeks[1].y==boxs[1].y))
&&((obyeks[2].x==boxs[2].x)&&(obyeks[2].y==boxs[2].y))
&&((obyeks[3].x==boxs[3].x)&&(obyeks[3].y==boxs[3].y)))
{
}
}
Copy link to clipboard
Copied
pretty good error message. you're missing a right bracket at the end:
var obyeks:Array=new Array();
var boxs:Array=new Array();
obyeks=[puzzle1,puzzle2,puzzle3];
boxs=[kotak1,kotak2,kotak3];
for(var i:Number=0;i<obyeks.length;i++)
{
obyeks[i].addEventListener(MouseEvent.MOUSE_DOWN,startdrag);
obyeks[i].addEventListener(MouseEvent.MOUSE_UP,stopdrag);
}
function startdrag(e:MouseEvent) {
ecurrentTarget.startDrag();
}
function stopdrag(e:MouseEvent) {
ecurrentTarget.stopDrag();
for(var i:Number=0 ;i<obyeks.length;i++)
{
for(var j:Number=0;j<boxs.length;j++)
{
if ((Math.abs(obyeks[i].x - boxs[j].x) < 50) && (Math.abs(obyeks[i].y - boxs[j].y) <50))
obyeks[i].x=boxs[j].x;
obyeks[i].y=boxs[j].y;
}
}
}
function updateScore()
{
for (var i:Number=0;i<obyeks.length;i++)
{
if (((obyeks[0].x==boxs[0].x)&&(obyeks[0].y==boxs[0].y))
&&((obyeks[1].x==boxs[1].x)&&(obyeks[1].y==boxs[1].y))
&&((obyeks[2].x==boxs[2].x)&&(obyeks[2].y==boxs[2].y))
&&((obyeks[3].x==boxs[3].x)&&(obyeks[3].y==boxs[3].y)))
{
// you're doing nothing here, yet
}
}
} // this is the previously missing right bracket