Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 316
0 Users 8 Guests Online

Moving a Movie Clip

1) Open Macromedia Flash-- If you do not have, google Macromedia Flash.
2) Start a new flash document

Here we go!

Clck F9 to open the actions panel.

Type in
Code
stop();

Or Esc + S + T (Short cut)

Now, click F9 again to close the actions panel, and draw a circle with a mouth and eye.

Now, press CTRL A and then F8 and make it a Movie Clip.

Now, select your movie clip and click properties and set the instance as "man" , now, press F9 again to open the actions panel for the movie clip and enter the folloing code:
Code

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;
}
}


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:

Code
onClipEvent(enterFrame){

This means that everything between { and } runs every time it goes to a new frame.
Code
if(Key.isDown(Key.RIGHT)){
this._x += 5;

If the Right key is down, the movieclip will move +5 X.
Joshua
Author:
Views:
2013
Rating:
There are currently no comments for this tutorial.