The aim of the tutorial is to:
Show you how one instance of a symbol communicates with another. A fundamental part of flash movie is to place symbols within symbols (see previous tutorial: Tweens within Tweens). When movies get complex the structure of one symbol inside another inside another may also become complex. When you place one symbol inside another it is called: Nesting
The aim of this tutorial is to give you an idea of how these symbols communicate with one another. This tutorial is designed to give you some practical experience of how this is done.
Nesting
In Flash when you place one object inside another they are nested one inside another. The following is an explanation of the nesting used in the example flash movie above:
Main Stage
(Click to enlarge)
This is the
main stage of the movie. I know it is the main stage because of the tab:
When you open a Flash movie it will always display the main stage. This is your work area where you place all the objects that make up your movie.
All the symbols you create are in the Library.
On the stage above is an instance of the symbol webwasp. It is an instance of the symbol which is highlighted. I know this because of the blue rectangle and the centre point
in the middle of the webwasp on stage.
Name: Main Stage
Action Script path: _root
Above the word webwasp you will see a tab:
.
Scene 1 is the main stage of the movie referred to in the ActionScript as: _root
All scenes have a _root directory.
First Nesting: main stage > Webwasp MC
Instance Name: webwasp
Symbol Name: webwasp MC
Action Script path: _root.webwasp
This is a symbol which is on the main stage. The symbol is called webwasp MC. You can see the symbol name in tab above the word: webwasp
- The tabs above the word webwasp: Scene1 is the main stage and webwasp MC is the name of the symbol not the name of the instance.
Note: You cannot see the instance name in the tabs.
Second Nesting: main stage > webwasp MC > web
MC
Instance Name: web
Symbol Name: web MC
Action Script path: _root.webwasp.web
Look at the tabs to see the nesting.
Third Nesting: main stage > webwasp MC > web MC > web
graphic
Instance Name: There is
no instance name.
Symbol Name: web Graphic
There is no Instance name for web graphic because graphics cannot have instance names only symbol names.
Action Script path: There is
no Path.
Note: Because a graphic cannot have an instance name it cannot be referred to in the actionscript.
To refer to a graphic (or button) you need to nest it inside a movie clip or convert it to a movie clip.
Note: Look at the little icons in the tabs above the word web: You can tell that the symbol is a graphic because the icon is different to that of a movie clip.
Main Stage or Scene Icon
Movie Clip Icon
Graphic Icon
Button Icon
Note: The same icons are used in the Library. See picture of main stage above.
Creating a Movie with Nested Symbols
Creating the symbols
For the buttons to be able to control the rotating web in the example above they have to be able to find the path to this object.
When you are creating symbols which are nested (inside) others you must always start furthest away from the main stage and work backwards. In the above example you must create the symbols in the following order:
1st: web graphic: Static graphic: web
2nd: web MC: Animation of the static graphic: web
3rd: webwasp MC: Combination of the animated graphic web and the word wasp
Think of it like cooking: First get your ingredient, then cook them, last of all put them on the table. Your main stage is the dinning table!
Step one: static graphic: web
Note: If have done the previous tutorial: Tween within
Tween and you are confident with creating tweens, use the Flash movie that
you created there and go straight to: Step five
The first symbol you need to create is: web graphic
- Go to: Insert > New Symbol
name: web graphic
Behavior: Graphic
Click: ok
You should now see these tabs at the top of the work area.
- Type a word on stage or draw something. I typed: web
Finally you are ready to place your work on the main stage.
Before you can refer to the instance in the action script it needs a name.
The second button should make the animation play instead of stop. Thus do the same as for the last button but do not do point 5. Your actionscript should look like this:
on (release) {I hope you found this tutorial easy to understand. A lot of people have difficulty with target paths in Flash, but they are essential to master if you are to get to grips with Flash.