0
votes

i have been learning action script 3 and now i get 2 errors i cant fix the main one being 1084: Syntax error rightparen before function

var blueS_1 = new blueS();

blueS_1.x = 50;
blueS_1.y = 50;

addChild(blueS_1);

blueS_1.addEventListener(MouseEvent.MOUSE_DOWN,onclick


function onclick(e:MouseEvent);:void {
trace("click!");
}
1

1 Answers

2
votes

You should look some examples while learning. And when facing an issue, search for a solution and compare your code to examples.

You have couple very simple mistakes there.

Your code:

blueS_1.addEventListener(MouseEvent.MOUSE_DOWN,onclick

function onclick(e:MouseEvent);:void {
    trace("click!");
}

Example:

blueS_1.addEventListener(MouseEvent.MOUSE_DOWN,onclick);

function onclick(e:MouseEvent):void {
    trace("click!");
}

So, missing ); from event listener line and extra ; at function opener.