Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

1084:Syntax error:expecting right brace before end of program. It was working before earlier but now it doesn't.

mackenziej14390
Level 1
Level 1

Heres my code:

import flash.events.MouseEvent;

/*

When home button is clicked, goes directly back to the home frame

*/

home_btn.addEventListener(MouseEvent.CLICK,goHome);

/*

Function acts as a command when MouseEvent is interacted with

*/

function goHome(event:MouseEvent):void {

/*

  Goes to home frame and stops animation

*/

gotoAndStop("home");

  /*

  Curly brace next line

  */

}

/*

Function tells animation to set language to display as Englsih

*/

function setLanguage():void {

  /*

  If statement is the choice at the crossroads

  */

  if(language == "English"){

  /*

  Text field is displayed in English counting the # of times the animation has played

  */

  info_txt.text = "The animation has played " + String(count) + "x.";

  /*

  Else and if are both the crossroads meaning choose left, right, or backwards. In this case its the language

  */

} else if(language == "German"){

/*

Displays the text field in another language increasing the number of times the animation is played

*/

info_txt.text = "Die Animation wurd " + String(count) + "x.";

  /*

  If the Spanish button is clicked the text field will be in Spanish

  */

  } else if(language == "Spanish"){

  /*

  The text field is the same thing but a different language continuing the # of times

  */

  info_txt.text = "La animacion ha jugado " + String(count) + "x.";

  /*

  Will display language in Italian if button is clicked by user

  */

  } else if(language == "Italian"){

  /*

  Text field displays "This animation has played blank # of times"

  */

  info_txt.text = "L'animazione ha giocato " + String(count) + "x.";

  /*

  */

  Curly brace next line

  /*

  }

/*

Curly brace next line

*/

/*

Set language for 1 of the 4 language buttons when clicked the text field displays one of the four languages

*/

function

setLanguage();

/*

English_ btn will display text in english when MouseEvent is interacted with

*/

english_btn.addEventListener(MouseEvent.CLICK, setEnglish);

/*

german_btn will display text in german when MouseEvent is interacted with

*/

german_btn.addEventListener(MouseEvent.CLICK, setGerman);

/*

Spanish_btn will display text in Spanish when MouseEvent is interacted with

*/

spanish_btn.addEventListener(MouseEvent.CLICK, setSpanish);

/*

Italian_btn will display text in Italian when MouseEvent is interacted with

*/

italian_btn.addEventListener(MouseEvent.CLICK, setItalian);

/*

Commands setEnglish to be only English with user interaction

*/

function setEnglish(e:MouseEvent):void {

  /*

  Language is  set to english

  */

  language = "English";

  /*

  Sets language determines what is put into the text field

  */

  setLanguage();

  /*

  Curly brace next line

  */

}

/*

Function  commands the german_btn to respond by the MouseEvent

*/

function setGerman(e:MouseEvent):void {

  /*

  Language for is determined by set language

  */

  language = "German"

  /*

  Determines what goes in the text field

  */

  setLanguage();

  /*

  Curly brace next line

  */

}

/*

The MouseEvent responds when different language button is clicked

*/

function setSpanish(e:MouseEvent):void {

  /*

  Sets language to Spanish

  */

  language = "Spanish"

  /*

  Determins what goes into the text field

  */

  setLanguage();

  /*

  Curly brace next line

  */

}

/*

Function tells button be in Italian

*/

function setItalian(e:MouseEvent):void {

  /*

  Language for button is Italian

  */

  language = "Italian"

  /*

  Set language determines the language in the text field

  */

  setLanguage();

  /*

  Curly brace next line

  */

}

0 Replies