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

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

New Here ,
Nov 18, 2013 Nov 18, 2013

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?

TOPICS
ActionScript
2.1K
Translate
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

correct answers 1 Correct answer

Participant , Nov 18, 2013 Nov 18, 2013

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

Translate
Participant ,
Nov 18, 2013 Nov 18, 2013

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

Translate
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
LEGEND ,
Nov 18, 2013 Nov 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.

Translate
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
Guide ,
Nov 18, 2013 Nov 18, 2013
LATEST

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.

Translate
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