Showing posts with label Flash AS2. Show all posts
Showing posts with label Flash AS2. Show all posts

Friday, May 8, 2009

Newgrounds Username Variable for use in your games/movies!

If you have already published games/movies to newgrounds then this is something that you must add. It makes your games and movies way cooler and look more professional.

Newgrounds just added a function where your .swf file can recognize what user is playing your file.. Newgrounds automatically loads the username into your movie so the only thing you need to do is call it. The variable that NG loads is: _root.ng_username

Note that this only works if the user is logged in. So you have to make an if statement to see if the user is logged in.
An example is:

if (_root.ng_username == null)
{
textBox.text = "Hello there, how are you?";
{
textBox.text = "Hey, " + _root.ng_username + " how are you!";
}
}

This would make the textbox instanced 'textBox' show Hello there, how are you if the user is not logged in and it would show Hey exampleusername, how are you?

Flash Achievments Test

I was surfing the net trying to find good games and noticed that many games now have their own in-game achievement system. So I tried making my own version of achievments... You can try my attempt to make achievments here

What I simply did is I made a movie clip with two dynamic text boxes. And when a user does a specified action it makes the movie clip play and sends two variables to to the text boxes and it makes a movie-clip saying what achievment they did


If you would like the source code or explanation feel free to email me at:

plankenau@gmail.com