Skip to main content
Participating Frequently
November 18, 2013
Answered

1071: Syntax error: expected a definition keyword (such as function) after attribute _, not root.

  • November 18, 2013
  • 2 replies
  • 2140 views

I've been following a tutorial on YouTube on how to create a leader board for a game.

After putting in:

stop();

_ root.pos = SharedObject.getLocal("scoresTut");

_ root.pos.data.player1=_ root.player1.text;

_ root.pos.data.player2=_ root.player2.text;

_ root.pos.data.player3=_ root.player3.text;

_ root.pos.data.player4=_ root.player4.text;

_ root.pos.data.player5=_ root.player5.text;

_ root.pos.data.player6=_ root.player6.text;

_ root.pos.data.player1Score=_ root.player1.Score;

_ root.pos.data.player2Score=_ root.player2.Score;

_ root.pos.data.player3Score=_ root.player3.Score;

_ root.pos.data.player4Score=_ root.player4.Score;

_ root.pos.data.player5Score=_ root.player5.Score;

_ root.pos.data.player6Score=_ root.player6.Score;

It came up with the Syntaxt error above.

Can anyone help please?

This topic has been closed for replies.
Correct answer lalitha subramanian

When you are writing this program in AS3 you shoud not use _root. Instead of _root you can use MovieClip(root).

2 replies

Ned Murphy
Legend
November 18, 2013

As lalitha says, in AS3 you do not use _root.  But in your case, you are using _ root which is one step worse.  The error is objecting to the space between the underscore and whatever follows.

It sounds as if you might be trying to follow an AS1/2 tutorial, which is not going to work if you set the file to publish for AS3.

Amy Blankenship
Legend
November 18, 2013

Also, this is not a good way to work in ActionScript 3. Part of the point of Actionscript 3 is to encourage good programming practices, and reaching up from child objects to parent objects is decidedly not good practice.

lalitha subramanianCorrect answer
Inspiring
November 18, 2013

When you are writing this program in AS3 you shoud not use _root. Instead of _root you can use MovieClip(root).