literature

ActionScript Tutorial 1

Deviation Actions

JohnJensen's avatar
By
Published:
369 Views

Literature Text

Maybe I just should call it a code tutorial 8D

sections
1. Variables
2. XY stuff
3. rotation
4. Key is down
5. if
6. numbers
7. random
8. Your first RPG
9. platformer (sucks)

in array list:
section = ["Variables","XY stuff","rotation","Key is down","if","numbers","random","Your first rpg","platformer (sucks)"];

XDDD

1. Variables
We use variables ALOT, or.. I do =P
Variables can be numbers and letters.
Sometimes we use

var

infront of our variables...

var myName = "John";

My name is John 8D
Now a little bit more advanced

Make a textbox, there where it says Static, choose Dynamic.

Then press at the textbox, then in the lower screen you see "var" , there you have to write: showAll

Then on layer 1, right click on the frame and choose Actions.

Then put this in:

var myName = "John";
var myAge = "12 but soon thirteen";
var myResistence = "Denmark";
_root.showAll = "My name is "+myName+", I am "+myAge+" years old, I live in "+myResistence+", and I am proud of it!";

This will return:
My name is John, I am 12 but soon thirteen years old, I live in Denmark, and I am proud of it!

You can edit the text and so on =D

There are also number variables..

var myNumber = 10;
var mySecond = 5;
_root.showAll = myNumber+mySecond;


Will return 15, cuz 10 + 5 = 15 8D

Look up my variables tut for more...


2. XY Stuff

look at this:


this._x = 302;
this._y = 126;


It'll make my x be 302, and my y be 126.

If you dunno what I mean, you didn't listen in math class XDDD


3. rotation

want your player to rotate?


this._rotation += 10;


Will make your movie clip, rotate 8D


4. Key is down

When playing flash games you'll have to dress the arrows keys and so..

"How do I do that? :B"

Well, we make a if key is down command 8D

if(Key.isDown(Key.???)){
}


Where it says ??? you can write:

RIGHT (right arrow key)
UP
DOWN
LEFT
SHIFT
CAPSLOCK
CONTROL
PGDN
PGUP

and alot more 8D

in the middle of the { }
you can write what then will happen af clicking the key.


5. if

we use IF alot in flash, or I do 8D

like, we use the old variable:
var myName = "John";
var myAge = "12 but soon thirteen";
var myResistence = "Denmark";

and add this:

if(myAge<13){
You = "banned";
}

this means if you wrote a number in myAge which is under 13 you'll get banned 8D

ask me for more >_>


6. numbers

we use numbers in math, yes

so here is the four math thingies:
+ plus
- minus
/ diviade
* multiply


7. random

check my random variables tutorial XDDD


8. Your first RPG

Tutorial coming soon


9. platformer

Tutorial coming soon



Sorry for a bad tut 8E ^^;
i like pie
© 2007 - 2024 JohnJensen
Comments9
Join the community to add your comment. Already a deviant? Log In
Tomochiro's avatar
I too have an uncle... come in