Đang chuẩn bị liên kết để tải về tài liệu:
Học Actionscript 3.0 - p 21

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Geometry and Trigonometry storing the current angle in a variable (line 12) and incrementing the angle to the next button position (line 13). The value of the angle is converted from degrees to radians using deg2rad(), the utility function we’ve discussed before, at the end of the script. The button is then created using the library symbol with the SatelliteButton linkage class, centered, and positioned on the circle defined by the mainButton center point and radius. The same technique to move an object along a circular path is used here. The cosine of the current angle times the radius of the. | Geometry and Trigonometry storing the current angle in a variable line 12 and incrementing the angle to the next button position line 13 . The value of the angle is converted from degrees to radians using deg2rad the utility function we ve discussed before at the end of the script. The button is then created using the library symbol with the SatelliteButton linkage class centered and positioned on the circle defined by the mainButton center point and radius. The same technique to move an object along a circular path is used here. The cosine of the current angle times the radius of the circle determines the x coordinate and the sine of the angle multiplied by the circle s radius calculates the y coordinate lines 16 and 17 . Each button is then given a name in line 18 consisting of an uppercase B and the number of the button taken from the loop counter. The first button for example will be B0 the second B1 and so on. the last line of this code block adds a mouse click listener to each button that calls the onClick function found in lines 36 through 38. In this simple example this function just traces the button name. However as discussed in Chapter 6 you can change this instruction to update the playhead in a movie clip and we ll teach you how to load external assets in Chapter 13. Because the buttons in this example have text labels Line 21 is very important. Setting the mouseChildren property of an object to false prevents the content of that object from receiving mouse events. By default the mouse will automatically interact with the text fields in this example that display the labels inside the buttons. This interaction includes text selection cursor feedback and more. With mouseChildren set to false for each button the text field child of the button won t react to mouse events. Line 22 is also important to this example because the navigation widget is draggable. By adding each button as a child of mainButton rather than the main timeline dragging the center .