TAILIEUCHUNG - Học Actionscript 3.0 - p 16

Inheritance so they can behave as a timeline. Lines 9 and 10 create two properties, compact and pickup, and type them as Car and Truck, respectively. Lines 14 and 20 create instances to these classes, passing in values for gas mileage and fuel available. Both compact and pickup are set to the same initial x value (lines 15 and 21), and pickup is given a different y value (line 22) so you can easily see both vehicles once they are added to the display list (lines 17 and 23). The custom methods for both instances are called right away (lines 18. | Inheritance so they can behave as a timeline. Lines 9 and 10 create two properties compact and pickup and type them as Car and Truck respectively. Lines 14 and 20 create instances to these classes passing in values for gas mileage and fuel available. Both compact and pickup are set to the same initial x value lines 15 and 21 and pickup is given a different y value line 22 so you can easily see both vehicles once they are added to the display list lines 17 and 23 . The custom methods for both instances are called right away lines 18 and 24 but the vehicles don t move because the go method calls are inside an event listener function lines 38 through 41 waiting for you to click the stage. Setting up the event listeners in lines 26 through 36 is very important and we ll discuss this after the code and a description of this example s output. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 package import import import public class Main extends MovieClip public var compact Car public var pickup Truck public function Main compact new Car 21 18 0 20 addChild compact pickup new Truck 16 23 0 100 addChild pickup onAddedToStage false 0 true public function onAddedToStage evt Event void onAddedToStage onClick false 0 true public function onClick evt MouseEvent void Chapter 6 OOP 129 Download from Wow eBook Inheritance The first thing to appear in the Output panel when testing your FLA is the initial trace caused by the custom method calls object Car opened sunroof object Truck lowered tailgate When the stage is clicked the go methods start the car and truck moving and traces like the one seen in the

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.