User Guide
Button 369
Example
The following example rotates two buttons on the Stage. Create two buttons on the Stage
called
control_btn and my_btn. Make sure that my_btn is not perfectly round, so you can
see it rotating. Then enter the following ActionScript in Frame 1 of the Timeline:
var control_btn:Button;
var my_btn:Button;
control_btn.onRelease = function() {
my_btn._rotation += 10;
};
Now create another button on the Stage called myOther_btn, making sure it isn't perfectly
round (so you can see it rotate). Enter the following ActionScript in Frame 1 of the Timeline.
var myOther_btn:Button;
this.createEmptyMovieClip("rotater_mc", this.getNextHighestDepth());
rotater_mc.onEnterFrame = function() {
myOther_btn._rotation += 2;
};
The MovieClip.getNextHighestDepth() method used in this example requires Flash Player
7 or later. If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
MovieClip.getNextHighestDepth() method.
See also
_rotation (MovieClip._rotation property), _rotation (TextField._rotation
property)
scale9Grid (Button.scale9Grid property)
public scale9Grid : Rectangle
The rectangular region that defines the nine scaling regions for the button. If set to null, the
entire button is scaled normally when any scale transformation is applied.
When you define a
scale9Grid property for a button, the button is divided into a grid with
nine regions based on the
scale9Grid rectangle, which defines the center region of the grid.
There are eight other regions of the grid, as follows:
■ The area in the upper-left corner outside of the rectangle
■ The area above the rectangle
■ The area in the upper-right corner outside the rectangle
■ The area to the left of the rectangle
■ The area to the right of the rectangle
■ The area in the lower-left corner outside the rectangle