• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

I keep getting the same error

Community Beginner ,
Nov 25, 2022 Nov 25, 2022

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)))
{

}
}

Views

148

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2022 Nov 25, 2022

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines