Hierarchy
Parent
Nested symbol's relationships may be described as a parent-child. Let's return to our example where mvMan included mvLeg, which in it's turn included mvToe. Imagine an animation when we tickle the mvToe and mvLeg will jerk and mvMan will laugh.
In the code it may look like that if placed in one of the frames of the mvToe
this.onRollOver = function() {
_parent.play();
_parent._parent.play ();
}
The first line of the function will invoke the leg's method, the second – will call man's method.
Let's create an example
- Create a simple button
- Highlight it and hit F8. Transform it to Movie Symbol. You may call it mvChild
- Create a new movie mvPanel and add inside it two instances of mvChild
- Enter the following code for the left button.
on(press) { this._width +=10; this._height +=10; } - Enter this code for the right button
on(press) { _parent._width +=10; _parent._height +=10; - Test the movie and observe the difference. When left button is clicked – only button itself increase the size. However when right button clicked – all panel including both button increases it's size