AS: Symbols 2005-06-30 19:15:30
This is not really about actionscript but still it's a good step in learning Flash.
What are symbols?
There are three kinds of symbols :
- Movie clips : They are animations with their own timelines and properties. They can be controlled with Actionscript. When you play a game, mostly everything you see that isn't static is a movie clip. If you pause the movie, the movie clips will continue to animate.
- Buttons : We use them when we want to give user choices or when we want the user to affect the movie. The most common usages of buttons are the play and replay buttons.
- Graphics : They are like movie clips but you can't control them with Actionscript. They are mostly used for motion tweens and such. They will play and pause with the movie.
There are two ways to create symbols :
- New symbol (Ctrl + F8) : Choose new symbol from the insert menu. From the pop up, give it a name and choose its behavior (movie clip, button or graphic).
- Convert to symbol (F8) : Select something you've drawn and hit F8. The same pop up will appear but something new is there : registration. This tells flash where on your shape he must assign the center of the symbol.
All the symbols you create are listed in the Library (Ctrl + L). When you click and drag a symbol from the library to the frame, it'll create an instance of it. If you double click an instance, you'll be able to edit the symbol and all its instances.
Now you know what symbols are. But how can we use them?
Probably the most used form of symbols, the movie clips can be controlled with Actionscript and will keep looping unless you stop them with a stop() action. They are useful when you want to animate looping things such as rain, waterfalls or wheels spinning.
Very useful for games, in places where the user has to make choices. Also used a lot for play buttons. When you edit a button, you will see there are 4 different frames : Up, Over, Down and Hit. Up is the frame that will be shown when the button is inactive, Over is the frame for mouse contact and Down is the frame for when you click the button. The Hit frame is what has to be touched with the mouse for the button to be active.
Graphics are useful when you want to use the same drawing a lot of times without affecting the movie filesize too much.
When you click a symbol and you open up the properties panel, you'll notice a Color drop-down menu with None as value. The other choices are :
- Brightness : Makes the symbol more white or black.
- Tint : Makes the symbol a certain color.
- Alpha : Makes the symbol transparent.
- Advanced : Lets you mix tint and alpha.
Basic buttons scripts
Here are three scripts you can use on buttons to control your movie. To use them, click on your button (on the frame, not in the library) and open the actions panel (F9). Then, paste one of these codes :
Go to scene named INTRO :
Finally, a few links for more information :
If you have any questions, feel free to ask here.