FUN: Playing around with variables

Now, I’ll show you some cool things you can do with variables. To start up, create a new DYNAMIC text box and give it the variable main. This will be the variable that will bounce around.


So, let’s start this. read the explanations in the codes, so you’ll understand them! Yeah, by the way, make a new MC and put it off stage! Well, now to the first code part, a whole line, yay!

main=1;//The main variable will be a 1

So, test your movie (CTRL+ENTER) and you’ll see the number one.


It’s easy to make the variable bounce, and it’s easy to modify the code. But no copy/paste! Put the code on the MC which is off stage.

onClipEvent(enterFrame){//When you enter the frame, the code will run itself over and over again
if(_root.main<10){//If the variable main is less than 10
_root.main+=1;//Variable will go higher
}else{//If it's more than that
_root.main=1;//Main will be reset.

So, if you want it to count to 100 before it will restart, change “10” to “100” and so on. If you want it to start from something else, change the ones to where you want it to start from. You can also put it to count backwards, I’m sure you’ll figure out how πŸ˜‰

So, now you do probably know variables a bit better, and that’s good, because variables is very important when you go more advanced! It’s almost all about variables and math, lol…. It might sound complicated but it isn’t, it’s kinda fun too πŸ™‚

Explore posts in the same categories: ActionScript 2.0, Basic

Tags: , , , ,

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: