Bloo Apple
Home Games and Movies

Games and Movies

Games and Movies Games and Movies
Latest Game
Pokemon Match
Coming Soon...
Droppin Beats 4
Paper Mario Maze
Want Action?
Join me on my next project to be part of something awesome
 
 
 
 
 

Controlling Movie Clips


name that fairy

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.

movingFairy

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.

scaled fairy

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

 

Site Created July 17, 2009