AS: Main , it's better than leeching code!
What is this about?
This is a very short tutorial about clip events, clip events are the most basic way for you to trigger something constantly , this is useful for movement with keys, raising stuff, setting stuff and changing stuff constantly or one time,
The 3 Magical Stages!
1)Creating a movie clip
2)Looking at the handlers themselves
3)Proper syntax
Creating a movieclip
)draw something
)select it
)go to modify->convert to symbol
Looking at the handlers themselves
There are several importent handlers:
load
enterFrame
key down
load means when the MC is loaded and ususally triggers ONCE at the start, you use load for defining functions and variables
enterFrame is what we ususally do for constant actions since the actions trigger OVER AND OVER 12 (or whatever frames per second you use) times per second... this is useful for movement health bars and much more!
keyDown is rarely used since it's alternatives, but it triggers when a key is pressed.
Proper syntax
you're probebly asking how you will make it happen, it's quite simple actually, the syntax on a movieclip's actions is
onClipEvent(handler){
//do actions
}
onClipEvent(some other handler){
//do some other actions
}
so you could do
onClipEvent(load){
this.speed=5;
}
onClipEvent(enterFrame){
this._x+=this.speed;
}
and the movieclip will move according to it's speed...
pretty simple and useful eh ;)?