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

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

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 flash.display.MovieClip import flash.events.Event import flash.events.MouseEvent public class Main extends MovieClip public var compact Car public var pickup Truck public function Main compact new Car 21 18 compact.x 0 compact.y 20 addChild compact compact.openSunroof pickup new Truck 16 23 pickup.x 0 pickup.y 100 addChild pickup pickup.lowerTailgate this.addEventListener Event.ADDED_TO_STAGE onAddedToStage false 0 true public function onAddedToStage evt Event void this.removeEventListener Event.ADDED_TO_STAGE onAddedToStage stage.addEventListener MouseEvent.CLICK onClick false 0 true public function onClick evt MouseEvent void compact.go pickup.go Chapter 6 OOP 129 Download from Wow eBook www.wowebook.com 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

crossorigin="anonymous">
Đã 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.