560
Animation, Filters, and Drawings
Next, you create a new Button component instance and give it an instance name of
small_button
. Whenever you click this button, the movie clip that you created earlier
resizes to 100 pixels wide by 100 pixels high. The fourth section of code dynamically
creates a new Button instance named
large_button
which, when clicked, resizes the
target movie clip to 450 pixels wide by 300 pixels high. The final section of code creates a
new Button instance that the user can toggle on and off. When the button is in the on
state, the 9-slice grid is applied. If the button is in the off state, the 9-slice grid is disabled.
14.
Save the Flash document and select Control > Test Movie to test the SWF file.
This code example adds and positions three Button component instances on the Stage and
creates event listeners for each button. If you click the Large button with the 9-slice grid
disabled, you can see that the image becomes distorted and looks stretched. Enable the 9-
slice grid by clicking the toggle button and click the Large button again. With the 9-slice
grid enabled, the circle in the upper-left corner should no longer appear distorted.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...