TAILIEUCHUNG - Học Actionscript 3.0 - p 21

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 .

TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.