Button._parent Property | Flash 6 |
a reference to the movie clip in which the button resides | read/write |
The _parent property is an object reference to the movie clip that contains theButton. For example, if we have a button named go_btn in a clip named mainSection_mc, then go_btn. _parent refers to mainSection_mc.
Though it is possible to reassign the _parent property to another clip (or any other value), doing so has little purpose—only the reference is changed, not the physical structure of the clip and buttons.
The _parent property is often used to control a movie clip from a button event handler, based on some user interaction. For example, in the following code, when begin_btn is clicked, the movie clip in which it resides plays:
begin_btn.onRelease = function () { this._parent.play(); }
Note that in the Flash 5-style of attaching event handlers directly to objects (e.g., on (press)), the _parent reference is not necessary, because this refers to the containing movie clip. For information on button event handler scope, see Chapter 10.
Button.onRelease( ), MovieClip._parent; Chapter 10