Dragging and Dropping Movie Clip Instances

Kéo và Thả Movie Clip trường hợp Trong giao diện người dùng, đôi khi hữu ích để thêm kéo và thả các hành vi để phim trường clip dài một-nó liên quan tới quá trình cách click và kéo movie clip trường xung quanh sân khấu, để khi họ đang phát hành (bỏ) | Dragging and Dropping Movie Clip Instances In user interfaces it s sometimes useful to add drag-and-drop behaviors to movie clip instances a term that refers to the process of clicking and dragging movie clip instances around the stage so that when they re released dropped they ll perform a set of actions determined by the location where they re dropped. The easiest way to conceptualize this type of behavior is by thinking of the trashcan icon on your computer desktop If you drag a file over the trashcan and let go of it that file is deleted however if you re not over the trashcan when you let go you ve simply moved the file icon. The most common way to create drag-and-drop items in Flash is by using _droptarget or hitTest . Accessing the _droptarget property of a movie will return the path in slash syntax to the highest movie clip instance that the currently dragged movie clip instance is over. Using the hitTest method you can determine whether the bounding box of one instance is touching the bounding box of another and take action accordingly. For more on this topic see Lesson 8 Using Conditional Logic. The hitTest method is used more frequently because it s more versatile than the _droptarget property. In this exercise you ll extend your project to dynamically create a row of icons simple graphical movie clip instances that can be dragged and dropped onto the canvas_mc movie clip instance using hitTest . When dropped a copy of the movie clip instance will be created using duplicateMovieClip and the original will be sent back to its initial position. 1. Open . This file is as you left it at the end of the preceding exercise. You will continue to add ActionScript to the _root timeline in this exercise. You ll create a function that creates the row of icons below the canvas_mc movie clip instance. Then you ll add the ActionScript that makes them draggable and the ActionScript that detects whether they were dropped onto canvas_mc. 2. With the Actions panel

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.