Thursday, September 15, 2011

Difference between a Graphic and a MovieClip

Any flash symbol can be either of the following:

1. Button
2. Movie Clip
3. Graphic

Button will be part of later posts. This post mainly deals with movie clip and graphics. First let us understand the two.

Both movie clips and graphics can be used to create animations. However, there are many differences between them. A graphic is a static object but movie clips can be dynamically worked upon. Only movie clips can have instances and instance names. Consequently they can be uniquely identified using the code. Whenever any movie clip is accessed, a copy of it is created from the flash library and the animation is performed over it. This copy so created could be blurred, slightly distorted, skewed, or can have multiple differences from the original movie clip, but only during run-time. This is just to cut down the computer memory usage by keeping the size of the swf file small.



Lets analyze the first statement, that both these symbols can contain animations.
In a movie clip, the animation is done on and by the graphics only. Here, all the parts of any animating body can be controlled independently, as they are part of separate timelines and also because we can have timeslines inside the main timesline of the movieclip. But for the graphics, all the animations happen in a single timeline. This makes the graphics less dynamic.


In other words,
The timeline of a Graphic Symbol instance is dependent on the timeline of the movie the instance is placed in.
The timeline of a Movie Clip instance is independent of the timeline of the movie the instance is placed in.
 Let us try a fun example.

Put any graphic image in the first frame of the main timeline. Place this image with slight variation in the successive frames for, say, 25 frames. If you publish this file, you would see some animation running through frame 1-25. Try deleting 10 frames from this, and the animation runs through only first 15 frames. If we delete all other frames except the first, and then publish the file, we see a static image, with no animation. In all the above cases, the animation runs in loop, from 1st frame to the last, and then back to first frame.

Suppose we convert any symbol to a movie clip, no matter, how many frames we add or subtract from the main timeline, the movie clip runs in loop in its own time line.



No comments:

Post a Comment