Copy link to clipboard
Copied
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?
When you are writing this program in AS3 you shoud not use _root. Instead of _root you can use MovieClip(root).
Copy link to clipboard
Copied
When you are writing this program in AS3 you shoud not use _root. Instead of _root you can use MovieClip(root).
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now