The Basic of moving a movieclip
-Download the .fla HERE!
-Click HERE! to see the .swf
Create a New Flash Document,Select the first keyframe and press F9 twice to open the Actions, and insert this code:
stop();
This will stop the movie on the selected frame.
Now, draw something like this:
Press Ctrl+A to select it, and press F8.Name it "man" and choose "movieclip".

Done?
Ok, now select your movieclip and open the Properties (press F9),
and set the instance name to "man".

Then, press F9 again to view Actions,
and insert this code into the movieclip:
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += 5;
this._xscale = 100;
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;
this._xscale = -100;
}
if(Key.isDown(Key.UP)){
this._y -= 5;
}
if(Key.isDown(Key.DOWN)){
this._y += 5;
}
}
Now, press Ctrl+Enter to test your movie!
To make it move smoother,
click anywhere on the grey area, press F9 to open the properties and set the Frame rate to about 30 fps ;)
Here`s a explanation of the codes:
onClipEvent(enterFrame){
This means that everything between { and } runs every time it goes to a new frame.
if(Key.isDown(Key.RIGHT)){
this._x += 5;
If the Right key is down, the movieclip will move +5 X.

and when the Left key is down, the movie clip will move -5 X, and +&- Y when the Up and Down keys are down.
this._xscale = -100;
This means that the movieclip will be scaled -100 X.
That`s all! :D
1 comments:
theres enough of these tutorials already, stop makin them
Post a Comment