|
Controlling Movie Clips

In actionscript 3.0 you can control movie clips several ways, through classes, and putting code inside of frames, and giving the movie clip an instance name. To keep things consistent I will make it so you can paste the code inside of a frame, and give the movie clip an instance name.

addEventListener(Event.ENTER_FRAME,mcMovements);
function mcMovements(event:Event) {
myMovieClip.x -= 5;
}
The Break Down... In this code I have also added a while statement. This while statement says (while the flash document is being executed, do the actions inside the opening and closing braces. The code I have provided inside the while statement is to move the movieClip on the x axis continuously by an increment of 5.
You do not need to initialize the movieClip in the actionscript document because it is already on the documents stage. You can also initialize it without putting the movieClip on ur stage, and it will be placed at the axis point of 0,0. You can edit this in the code provided.

var myMovieclip:MovieClip = new MovieClip();
myMovieClip.x = 75;
myMovieClip.y = 300;
|